from numba import njit

@njit(cache=True)

def f(k):

    a = 7%k

    for i in range(k):

        if a == 0:

            print((i+1))

            break

        a = (a*10+7)%k

    else:

        print((-1))

k = int(eval(input()))

f(k)
from numba import njit,prange

@njit('i8(i8)',cache=True)

def f(k):

    a = 7%k

    for i in prange(k):

        if a == 0:

            return i+1

        a = (a*10+7)%k

    else:

        return -1

k = int(eval(input()))

print((f(k)))
from numba import njit


@njit(cache=True)
def f(k):
    a = 7 % k
    for i in range(k):
        if a == 0:
            print((i + 1))
            break
        a = (a * 10 + 7) % k
    else:
        print((-1))


k = int(eval(input()))
f(k)

from numba import njit, prange


@njit("i8(i8)", cache=True)
def f(k):
    a = 7 % k
    for i in prange(k):
        if a == 0:
            return i + 1
        a = (a * 10 + 7) % k
    else:
        return -1


k = int(eval(input()))
print((f(k)))

-from numba import njit +from numba import njit, prange -@njit(cache=True) +@njit("i8(i8)", cache=True) -    for i in range(k): +    for i in prange(k): -            print((i + 1)) -            break +            return i + 1 -        print((-1)) +        return -1 -f(k) +print((f(k)))