K = int(input())

mod = 7
number = 1

for i in range(K):
    if mod % K == 0:
        break
    number += 1
    mod = (mod * 10 + 7) % K

if mod % K == 0:
    print(number)
else:
    print(-1) K = int(input()) K int(input()) int input() input mod = 7 mod 7 number = 1 number 1 for i in range(K):
    if mod % K == 0:
        break
    number += 1
    mod = (mod * 10 + 7) % K i range(K) range K if mod % K == 0:
        break
     mod % K == 0 mod % K mod K 0 break number += 1 number 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(number)
else:
    print(-1) mod % K == 0 mod % K mod K 0 print(number) print number print(-1) print -1 mod = (mod * 10 + 7) % K (mod * 10 + 7) % K mod K = int(input()) int(input()) K number += 1 1 number mod = 7 7 mod number = 1 1 number
K = int(input())

mod = 7
number = 1

for i in range(K):
    if mod % K == 0:
        break
    number += 1
    mod = (mod * 10 + 7) % K

if mod % K == 0:
    print(number)
else:
    print(-1)