k = int(input())


if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    exc = 0
    for i in range(1, 10 ** 8):
        exc = exc * 10 + 7
        exc = exc % k
        if exc % k == 0:
            ans = i
            break
    print(ans) k = int(input()) k int(input()) int input() input if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    exc = 0
    for i in range(1, 10 ** 8):
        exc = exc * 10 + 7
        exc = exc % k
        if exc % k == 0:
            ans = i
            break
    print(ans) k % 2 == 0 or k % 5 == 0 k % 2 == 0 k % 2 k 2 0 k % 5 == 0 k % 5 k 5 0 print(-1) print -1 exc = 0 exc 0 for i in range(1, 10 ** 8):
        exc = exc * 10 + 7
        exc = exc % k
        if exc % k == 0:
            ans = i
            break
     i range(1, 10 ** 8) range 1 10 ** 8 10 8 exc = exc * 10 + 7 exc exc * 10 + 7 exc * 10 exc 10 7 exc = exc % k exc exc % k exc k if exc % k == 0:
            ans = i
            break
     exc % k == 0 exc % k exc k 0 ans = i ans i break print(ans) print ans exc = exc % k exc % k exc k = int(input()) int(input()) k ans = i i ans exc = exc * 10 + 7 exc * 10 + 7 exc exc = 0 0 exc
k = int(input())


if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    exc = 0
    for i in range(1, 10 ** 8):
        exc = exc * 10 + 7
        exc = exc % k
        if exc % k == 0:
            ans = i
            break
    print(ans)