k = int(input())

ok = False
for i in range(1, k+1):
   if i == 1:
      a = 7 % k
   else:
      anext = (a * 10 + 7) % k
      a = anext
   if a == 0:
      print(i)
      ok = True
      break

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

ok = False
for i in range(1, k+1):
   if i == 1:
      a = 7 % k
   else:
      anext = (a * 10 + 7) % k
      a = anext
   if a == 0:
      print(i)
      ok = True
      break

if not ok:
   print(-1)
