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