x = int(input())
cnt = 1
mod = 7

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

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