k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)
 k = int(input()) k int(input()) int input() input x = 7 x 7 ans = 1 ans 1 if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break 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 elif 7%k == 0:
  ans = 1 7%k == 0 7%k 7 k 0 ans = 1 ans 1 for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break i range (1,k) range 1 k x = (x*10+7)%k x (x*10+7)%k x*10+7 x*10 x 10 7 k if x%k == 0:
      ans = i+1
      break x%k == 0 x%k x k 0 ans = i+1 ans i+1 i 1 break print(ans) print ans ans = 1 1 ans ans = 1 1 ans ans = i+1 i+1 ans k = int(input()) int(input()) k x = 7 7 x x = (x*10+7)%k (x*10+7)%k x
k = int(input())
x = 7
ans = 1
if k%2 == 0 or k%5 ==0:
  print(-1)
  exit()
elif 7%k == 0:
  ans = 1

else:
  for i in range (1,k):
    x = (x*10+7)%k

    if x%k == 0:
      ans = i+1
      break

print(ans)

