import sys

import math

import time

sys.setrecursionlimit(int(1e6))

if False:

    dprint = print

else:

    def dprint(*args):

        pass



k = list(map(int, input().split()))[0]



am = 7 % k

i = 1



for i in range(k):

    if am==0:

        print(i+1)

        exit()

    else:

        i+=1

        am=(am*10+7)%k

 

print('-1')

import sys

import math

import time

sys.setrecursionlimit(int(1e6))

if False:

    dprint = print

else:

    def dprint(*args):

        pass



k = list(map(int, input().split()))[0]



modk = 7 % k

i = 1

for i in range(k):

    if modk == 0:

        print(i+1)

        exit()



    modk = (modk * 10 + 7) % k

else:

    print(-1)

import sys
import math
import time

sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:

    def dprint(*args):
        pass


k = list(map(int, input().split()))[0]
am = 7 % k
i = 1
for i in range(k):
    if am == 0:
        print(i + 1)
        exit()
    else:
        i += 1
        am = (am * 10 + 7) % k
print("-1")

import sys
import math
import time

sys.setrecursionlimit(int(1e6))
if False:
    dprint = print
else:

    def dprint(*args):
        pass


k = list(map(int, input().split()))[0]
modk = 7 % k
i = 1
for i in range(k):
    if modk == 0:
        print(i + 1)
        exit()
    modk = (modk * 10 + 7) % k
else:
    print(-1)

-am = 7 % k +modk = 7 % k -    if am == 0: +    if modk == 0: -    else: -        i += 1 -        am = (am * 10 + 7) % k -print("-1") +    modk = (modk * 10 + 7) % k +else: +    print(-1)