import sys

k = int(input())

a =7%k
if a == 0:
    print(1)
    sys.exit()

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

k = int(input())

a =7%k
if a == 0:
    print(1)
    sys.exit()

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