K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  # 計算桁を減らすために(mod K)で7, 77, 777,,,を計算する
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  
  count += 1
  if count > K:
    count = -1
    break
    
print(count) K = int(input()) K int(input()) int input() input sevens = 7 % K sevens 7 % K 7 K count = 1 count 1 while(sevens % K !=0):
  # 計算桁を減らすために(mod K)で7, 77, 777,,,を計算する
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  
  count += 1
  if count > K:
    count = -1
    break
     sevens % K !=0 sevens % K sevens K 0 sevens = sevens * (10 % K) + (7 % K) sevens sevens * (10 % K) + (7 % K) sevens * (10 % K) sevens 10 % K 10 K 7 % K 7 K sevens = sevens % K sevens sevens % K sevens K count += 1 count 1 if count > K:
    count = -1
    break
     count > K count K count = -1 count -1 break print(count) print count count = -1 -1 count count += 1 1 count K = int(input()) int(input()) K sevens = 7 % K 7 % K sevens sevens = sevens * (10 % K) + (7 % K) sevens * (10 % K) + (7 % K) sevens sevens = sevens % K sevens % K sevens count = 1 1 count
K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  # 計算桁を減らすために(mod K)で7, 77, 777,,,を計算する
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  
  count += 1
  if count > K:
    count = -1
    break
    
print(count)