K = int(input())
count = 1
mod = 7
answer = -1

for _ in range(K):
    if mod % K == 0:
        answer = count
        break
    count += 1
    mod = (mod * 10 + 7) % K

print(answer) K = int(input()) K int(input()) int input() input count = 1 count 1 mod = 7 mod 7 answer = -1 answer -1 for _ in range(K):
    if mod % K == 0:
        answer = count
        break
    count += 1
    mod = (mod * 10 + 7) % K _ range(K) range K if mod % K == 0:
        answer = count
        break
     mod % K == 0 mod % K mod K 0 answer = count answer count break count += 1 count 1 mod = (mod * 10 + 7) % K mod (mod * 10 + 7) % K mod * 10 + 7 mod * 10 mod 10 7 K print(answer) print answer mod = (mod * 10 + 7) % K (mod * 10 + 7) % K mod count = 1 1 count answer = -1 -1 answer K = int(input()) int(input()) K count += 1 1 count mod = 7 7 mod answer = count count answer
K = int(input())
count = 1
mod = 7
answer = -1

for _ in range(K):
    if mod % K == 0:
        answer = count
        break
    count += 1
    mod = (mod * 10 + 7) % K

print(answer)