k=int(input())

if k%2==0 or k%5==0:
  print(-1)
else:
  s=1
  a=7
  while a%k!=0:
    a=(10*a+7)%k
    s+=1
  print(s) k=int(input()) k int(input()) int input() input if k%2==0 or k%5==0:
  print(-1)
else:
  s=1
  a=7
  while a%k!=0:
    a=(10*a+7)%k
    s+=1
  print(s) k%2==0 or k%5==0 k%2==0 k%2 k 2 0 k%5==0 k%5 k 5 0 print(-1) print -1 s=1 s 1 a=7 a 7 while a%k!=0:
    a=(10*a+7)%k
    s+=1
   a%k!=0 a%k a k 0 a=(10*a+7)%k a (10*a+7)%k 10*a+7 10*a 10 a 7 k s+=1 s 1 print(s) print s k=int(input()) int(input()) k a=7 7 a a=(10*a+7)%k (10*a+7)%k a s+=1 1 s s=1 1 s
k=int(input())

if k%2==0 or k%5==0:
  print(-1)
else:
  s=1
  a=7
  while a%k!=0:
    a=(10*a+7)%k
    s+=1
  print(s)
