K = int(input())

A = [0 for _ in range(K)]
for i in range(K):
    if i == 0:
        mod = 7 % K
    else:
        mod = (10 * A[i-1] + 7) % K
    A[i] = mod
    if mod == 0:
        print(i+1)
        exit()
print(-1) K = int(input()) K int(input()) int input() input 0 for _ in range(K) for _ in range(K) _ range(K) range K for _ in range(K) 0 A = [0 for _ in range(K)] A [0 for _ in range(K)] for i in range(K):
    if i == 0:
        mod = 7 % K
    else:
        mod = (10 * A[i-1] + 7) % K
    A[i] = mod
    if mod == 0:
        print(i+1)
        exit() i range(K) range K if i == 0:
        mod = 7 % K
    else:
        mod = (10 * A[i-1] + 7) % K
     i == 0 i 0 mod = 7 % K mod 7 % K 7 K mod = (10 * A[i-1] + 7) % K mod (10 * A[i-1] + 7) % K 10 * A[i-1] + 7 10 * A[i-1] 10 A[i-1] A i-1 i 1 7 K A[i] = mod A[i] A i mod if mod == 0:
        print(i+1)
        exit() mod == 0 mod 0 print(i+1) print i+1 i 1 exit() exit print(-1) print -1 mod = (10 * A[i-1] + 7) % K (10 * A[i-1] + 7) % K mod A = [0 for _ in range(K)] [0 for _ in range(K)] A mod = 7 % K 7 % K mod K = int(input()) int(input()) K
K = int(input())

A = [0 for _ in range(K)]
for i in range(K):
    if i == 0:
        mod = 7 % K
    else:
        mod = (10 * A[i-1] + 7) % K
    A[i] = mod
    if mod == 0:
        print(i+1)
        exit()
print(-1)
