K = int(input())

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

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