import sys

import math

import time

import numpy

sys.setrecursionlimit(int(1e6))

#dprint = print

def dprint(*args):

    pass



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



s = set()

i = 1

x = 7 % k



while(not (x in s)):

    if (x == 0):

        print(i)

        exit()

    s.add(x)

    x = (x*10+7)%k

    i = i + 1



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]



if (k % 7 == 0):

    l = 9*k/7

else:

    l = 9*k

dprint('k, l = ', k, l)



i = 1

n = 10

while(i < 10**6):

    m = n % l

    if (m == 1): # (10^i mod L = 1)

        print(i)

        exit()

    dprint('i, n, m = ', i, n, m)



    i = i + 1

    n = m * 10

else:

    print(-1)

import sys
import math
import time
import numpy

sys.setrecursionlimit(int(1e6))
# dprint = print
def dprint(*args):
    pass


k = list(map(int, input().split()))[0]
s = set()
i = 1
x = 7 % k
while not (x in s):
    if x == 0:
        print(i)
        exit()
    s.add(x)
    x = (x * 10 + 7) % k
    i = i + 1
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]
if k % 7 == 0:
    l = 9 * k / 7
else:
    l = 9 * k
dprint("k, l = ", k, l)
i = 1
n = 10
while i < 10**6:
    m = n % l
    if m == 1:  # (10^i mod L = 1)
        print(i)
        exit()
    dprint("i, n, m = ", i, n, m)
    i = i + 1
    n = m * 10
else:
    print(-1)

-import numpy -# dprint = print -def dprint(*args): -    pass +if False: +    dprint = print +else: + +    def dprint(*args): +        pass -s = set() +if k % 7 == 0: +    l = 9 * k / 7 +else: +    l = 9 * k +dprint("k, l = ", k, l) -x = 7 % k -while not (x in s): -    if x == 0: +n = 10 +while i < 10**6: +    m = n % l +    if m == 1:  # (10^i mod L = 1) -    s.add(x) -    x = (x * 10 + 7) % k +    dprint("i, n, m = ", i, n, m) -print((-1)) +    n = m * 10 +else: +    print(-1)