k=int(input())

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

ans=1
num=7
while num%k!=0:
  num=10*num+7
  num%=k
  ans+=1

print(ans) 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 ans=1 ans 1 num=7 num 7 while num%k!=0:
  num=10*num+7
  num%=k
  ans+=1 num%k!=0 num%k num k 0 num=10*num+7 num 10*num+7 10*num 10 num 7 num%=k num k ans+=1 ans 1 print(ans) print ans k=int(input()) int(input()) k num%=k k num ans+=1 1 ans ans=1 1 ans num=10*num+7 10*num+7 num num=7 7 num
k=int(input())

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

ans=1
num=7
while num%k!=0:
  num=10*num+7
  num%=k
  ans+=1

print(ans)