k=int(input())

if k%2==0 or k%5==0:
  print(-1); exit()

cnt=num=0
while 1:
  num+=7*pow(10,cnt,k)
  num%=k
  cnt+=1
  if num==0:
    break
print(cnt) k=int(input()) k int(input()) int input() input if k%2==0 or k%5==0:
  print(-1); exit() k%2==0 or k%5==0 k%2==0 k%2 k 2 0 k%5==0 k%5 k 5 0 print(-1) print -1 exit() exit cnt=num=0 cnt 0 =num=0 num 0 while 1:
  num+=7*pow(10,cnt,k)
  num%=k
  cnt+=1
  if num==0:
    break 1 num+=7*pow(10,cnt,k) num 7*pow(10,cnt,k) 7 pow(10,cnt,k) pow 10 cnt k num%=k num k cnt+=1 cnt 1 if num==0:
    break num==0 num 0 break print(cnt) print cnt num+=7*pow(10,cnt,k) 7*pow(10,cnt,k) num k=int(input()) int(input()) k num=0 0 num cnt=num=0 0 cnt num%=k k num cnt+=1 1 cnt
k=int(input())

if k%2==0 or k%5==0:
  print(-1); exit()

cnt=num=0
while 1:
  num+=7*pow(10,cnt,k)
  num%=k
  cnt+=1
  if num==0:
    break
print(cnt)
