k=int(input())
if k&1==0 or k%5==0:
  print(-1)
  exit()
elif 7%k==0:
  print(1)
  exit()
m=7
a=b=1
while(m>0):
  a=a*10%k
  m=(m+7*a)%k
  b+=1
print(b) k=int(input()) k int(input()) int input() input if k&1==0 or k%5==0:
  print(-1)
  exit()
elif 7%k==0:
  print(1)
  exit() k&1==0 or k%5==0 k&1==0 k&1 k 1 0 k%5==0 k%5 k 5 0 print(-1) print -1 exit() exit elif 7%k==0:
  print(1)
  exit() 7%k==0 7%k 7 k 0 print(1) print 1 exit() exit m=7 m 7 a=b=1 a 1 =b=1 b 1 while(m>0):
  a=a*10%k
  m=(m+7*a)%k
  b+=1 m>0 m 0 a=a*10%k a a*10%k a*10 a 10 k m=(m+7*a)%k m (m+7*a)%k m+7*a m 7*a 7 a k b+=1 b 1 print(b) print b k=int(input()) int(input()) k m=7 7 m a=a*10%k a*10%k a b+=1 1 b b=1 1 b a=b=1 1 a m=(m+7*a)%k (m+7*a)%k m
k=int(input())
if k&1==0 or k%5==0:
  print(-1)
  exit()
elif 7%k==0:
  print(1)
  exit()
m=7
a=b=1
while(m>0):
  a=a*10%k
  m=(m+7*a)%k
  b+=1
print(b)