k = int(input())
start = 7
if k % 2 == 0:
  print("-1")
  exit()
for i in range(k + 1):
  if start % k == 0:
    print(i + 1)
    exit()
  start = (start * 10 + 7) % k
print("-1") k = int(input()) k int(input()) int input() input start = 7 start 7 if k % 2 == 0:
  print("-1")
  exit() k % 2 == 0 k % 2 k 2 0 print("-1") print "-1" exit() exit for i in range(k + 1):
  if start % k == 0:
    print(i + 1)
    exit()
  start = (start * 10 + 7) % k i range(k + 1) range k + 1 k 1 if start % k == 0:
    print(i + 1)
    exit()
   start % k == 0 start % k start k 0 print(i + 1) print i + 1 i 1 exit() exit start = (start * 10 + 7) % k start (start * 10 + 7) % k start * 10 + 7 start * 10 start 10 7 k print("-1") print "-1" k = int(input()) int(input()) k start = (start * 10 + 7) % k (start * 10 + 7) % k start start = 7 7 start
k = int(input())
start = 7
if k % 2 == 0:
  print("-1")
  exit()
for i in range(k + 1):
  if start % k == 0:
    print(i + 1)
    exit()
  start = (start * 10 + 7) % k
print("-1")