K = int(input())
import sys
num = 0
for n in range(K):
  num = num * 10 + 7
  if num % K == 0:
    print(n+1)
    break
  num = num % K
else:
  print(-1) K = int(input()) K int(input()) int input() input import sys sys num = 0 num 0 for n in range(K):
  num = num * 10 + 7
  if num % K == 0:
    print(n+1)
    break
  num = num % K
else:
  print(-1) n range(K) range K num = num * 10 + 7 num num * 10 + 7 num * 10 num 10 7 if num % K == 0:
    print(n+1)
    break
   num % K == 0 num % K num K 0 print(n+1) print n+1 n 1 break num = num % K num num % K num K print(-1) print -1 num = num % K num % K num num = num * 10 + 7 num * 10 + 7 num K = int(input()) int(input()) K num = 0 0 num
K = int(input())
import sys
num = 0
for n in range(K):
  num = num * 10 + 7
  if num % K == 0:
    print(n+1)
    break
  num = num % K
else:
  print(-1)