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