K = int(input())

num = 7%K

for i in range(K):
  if num%K ==0:
    print(i+1)
    break
  else:
    num = (num*10 + 7)%K
    
else:
  print(-1) K = int(input()) K int(input()) int input() input num = 7%K num 7%K 7 K for i in range(K):
  if num%K ==0:
    print(i+1)
    break
  else:
    num = (num*10 + 7)%K
    
else:
  print(-1) i range(K) range K if num%K ==0:
    print(i+1)
    break
  else:
    num = (num*10 + 7)%K
     num%K ==0 num%K num K 0 print(i+1) print i+1 i 1 break num = (num*10 + 7)%K num (num*10 + 7)%K num*10 + 7 num*10 num 10 7 K print(-1) print -1 num = 7%K 7%K num K = int(input()) int(input()) K num = (num*10 + 7)%K (num*10 + 7)%K num
K = int(input())

num = 7%K

for i in range(K):
  if num%K ==0:
    print(i+1)
    break
  else:
    num = (num*10 + 7)%K
    
else:
  print(-1)