K = int(input())
 
if K % 2 == 0:
  print(-1)
  exit()

num = 0
for i in range(1, K+1):
  num = (num*10+7) % K
  if num == 0:
    print(i)
    exit()

print(-1) K = int(input()) K int(input()) int input() input if K % 2 == 0:
  print(-1)
  exit() K % 2 == 0 K % 2 K 2 0 print(-1) print -1 exit() exit num = 0 num 0 for i in range(1, K+1):
  num = (num*10+7) % K
  if num == 0:
    print(i)
    exit() i range(1, K+1) range 1 K+1 K 1 num = (num*10+7) % K num (num*10+7) % K num*10+7 num*10 num 10 7 K if num == 0:
    print(i)
    exit() num == 0 num 0 print(i) print i exit() exit print(-1) print -1 num = 0 0 num num = (num*10+7) % K (num*10+7) % K num K = int(input()) int(input()) K
K = int(input())
 
if K % 2 == 0:
  print(-1)
  exit()

num = 0
for i in range(1, K+1):
  num = (num*10+7) % K
  if num == 0:
    print(i)
    exit()

print(-1)