import sys



k = int(eval(input()))



a =7%k

if a == 0:

    print((1))

    sys.exit()



for i in range(2,10**7):

    a = (10*a+7) % k

    if a == 0:

        print(i)

        sys.exit()

    

print((-1))
import sys

def main():

    k = int(eval(input()))



    a =7%k

    if a == 0:

        print((1))

        sys.exit()



    for i in range(2,10**7):

        a = (10*a+7) % k

        if a == 0:

            print(i)

            sys.exit()



    print((-1))

    

main()
import sys

k = int(eval(input()))
a = 7 % k
if a == 0:
    print((1))
    sys.exit()
for i in range(2, 10**7):
    a = (10 * a + 7) % k
    if a == 0:
        print(i)
        sys.exit()
print((-1))

import sys


def main():
    k = int(eval(input()))
    a = 7 % k
    if a == 0:
        print((1))
        sys.exit()
    for i in range(2, 10**7):
        a = (10 * a + 7) % k
        if a == 0:
            print(i)
            sys.exit()
    print((-1))


main()

-k = int(eval(input())) -a = 7 % k -if a == 0: -    print((1)) -    sys.exit() -for i in range(2, 10**7): -    a = (10 * a + 7) % k + +def main(): +    k = int(eval(input())) +    a = 7 % k -        print(i) +        print((1)) -print((-1)) +    for i in range(2, 10**7): +        a = (10 * a + 7) % k +        if a == 0: +            print(i) +            sys.exit() +    print((-1)) + + +main()