x=7
ans=1
k=int(input())
if k%2==0 or k%5==0:
  print(-1)
else:
  for i in range(1,k):
    if x%k==0:
      break
    x=(x*10+7)%k
    ans+=1
  print(ans) x=7 x 7 ans=1 ans 1 k=int(input()) k int(input()) int input() input if k%2==0 or k%5==0:
  print(-1)
else:
  for i in range(1,k):
    if x%k==0:
      break
    x=(x*10+7)%k
    ans+=1
  print(ans) 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 for i in range(1,k):
    if x%k==0:
      break
    x=(x*10+7)%k
    ans+=1
   i range(1,k) range 1 k if x%k==0:
      break
     x%k==0 x%k x k 0 break x=(x*10+7)%k x (x*10+7)%k x*10+7 x*10 x 10 7 k ans+=1 ans 1 print(ans) print ans x=7 7 x ans=1 1 ans ans+=1 1 ans x=(x*10+7)%k (x*10+7)%k x k=int(input()) int(input()) k
x=7
ans=1
k=int(input())
if k%2==0 or k%5==0:
  print(-1)
else:
  for i in range(1,k):
    if x%k==0:
      break
    x=(x*10+7)%k
    ans+=1
  print(ans)