K = int(input())

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

n = 7
for i in range(1, 1000001):
    if n % K == 0:
        print(i)
        exit()
    n = (n * 10 + 7) % K
else:
    print(-1)