import sys
k = int(input())

a = 7
a = a % k
for i in range(1000000):
  if a ==0:
    print(i+1)
    sys.exit()
  else:
    a = 10*a+7
    a = a % k

print("-1") import sys sys k = int(input()) k int(input()) int input() input a = 7 a 7 a = a % k a a % k a k for i in range(1000000):
  if a ==0:
    print(i+1)
    sys.exit()
  else:
    a = 10*a+7
    a = a % k i range(1000000) range 1000000 if a ==0:
    print(i+1)
    sys.exit()
  else:
    a = 10*a+7
    a = a % k a ==0 a 0 print(i+1) print i+1 i 1 sys.exit() sys.exit sys exit a = 10*a+7 a 10*a+7 10*a 10 a 7 a = a % k a a % k a k print("-1") print "-1" a = a % k a % k a a = 10*a+7 10*a+7 a a = 7 7 a a = a % k a % k a k = int(input()) int(input()) k
import sys
k = int(input())

a = 7
a = a % k
for i in range(1000000):
  if a ==0:
    print(i+1)
    sys.exit()
  else:
    a = 10*a+7
    a = a % k

print("-1")
