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