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)))
import sys



if sys.argv[-1] == "ONLINE_JUDGE":

    from numba.pycc import CC

    cc = CC("solve")



    @cc.export('solve', 'i8(i8)')

    def f(k):

        a = 7 % k

        for i in range(k):

            if a == 0:

                return i + 1

            a = (a * 10 + 7) % k

        else:

            return -1

    cc.compile()

    exit(0)



from solve import solve

print((solve(int(eval(input())))))
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)))

import sys

if sys.argv[-1] == "ONLINE_JUDGE":
    from numba.pycc import CC

    cc = CC("solve")

    @cc.export("solve", "i8(i8)")
    def f(k):
        a = 7 % k
        for i in range(k):
            if a == 0:
                return i + 1
            a = (a * 10 + 7) % k
        else:
            return -1

    cc.compile()
    exit(0)
from solve import solve

print((solve(int(eval(input())))))

-from numba import njit, prange +import sys +if sys.argv[-1] == "ONLINE_JUDGE": +    from numba.pycc import CC -@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 +    cc = CC("solve") +    @cc.export("solve", "i8(i8)") +    def f(k): +        a = 7 % k +        for i in range(k): +            if a == 0: +                return i + 1 +            a = (a * 10 + 7) % k +        else: +            return -1 -k = int(eval(input())) -print((f(k))) +    cc.compile() +    exit(0) +from solve import solve + +print((solve(int(eval(input())))))