k=int(input())
x=0
for i in range(k):
  x*=10
  x+=7
  if x%k==0:
    print(i+1)
    exit()
  x%=k
print(-1) k=int(input()) k int(input()) int input() input x=0 x 0 for i in range(k):
  x*=10
  x+=7
  if x%k==0:
    print(i+1)
    exit()
  x%=k i range(k) range k x*=10 x 10 x+=7 x 7 if x%k==0:
    print(i+1)
    exit()
   x%k==0 x%k x k 0 print(i+1) print i+1 i 1 exit() exit x%=k x k print(-1) print -1 x=0 0 x x+=7 7 x x*=10 10 x k=int(input()) int(input()) k x%=k k x
k=int(input())
x=0
for i in range(k):
  x*=10
  x+=7
  if x%k==0:
    print(i+1)
    exit()
  x%=k
print(-1)