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