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