K = int(input())

mod = 7
cnt = 0

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

mod = 7
cnt = 0

for i in range(K):
    if mod % K == 0:
        cnt += 1
        break
    else:
        cnt += 1
        mod = (mod * 10 + 7) % K
if mod % K == 0:
    print(cnt)
else:
    print(-1)
