#! /usr/bin/env python3



import sys

int1 = lambda x: int(x) - 1

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(500000)





def isMultiple(s, m):

    tmp = 0

    for i in range(len(s)):

        tmp = (tmp * 10 + int(s[i])) % m

        if tmp == 0:

            return i

    return -1





k = int(readline())

acc = "7" * 50000000

if k % 2 == 0:

    ans = -1

else:



    ans = isMultiple(acc, k)

    if ans != -1:

        ans += 1



print(ans)

#! /usr/bin/env python3



import sys

int1 = lambda x: int(x) - 1

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(500000)



k = int(readline())



ans = -1

acc = 7 % k

for n in range(1, k + 10):

    if acc == 0:

        ans = n

        break

    acc = (10 * acc + 7) % k



print(ans)

#! /usr/bin/env python3
import sys

int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)


def isMultiple(s, m):
    tmp = 0
    for i in range(len(s)):
        tmp = (tmp * 10 + int(s[i])) % m
        if tmp == 0:
            return i
    return -1


k = int(readline())
acc = "7" * 50000000
if k % 2 == 0:
    ans = -1
else:
    ans = isMultiple(acc, k)
    if ans != -1:
        ans += 1
print(ans)

#! /usr/bin/env python3
import sys

int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
k = int(readline())
ans = -1
acc = 7 % k
for n in range(1, k + 10):
    if acc == 0:
        ans = n
        break
    acc = (10 * acc + 7) % k
print(ans)

- - -def isMultiple(s, m): -    tmp = 0 -    for i in range(len(s)): -        tmp = (tmp * 10 + int(s[i])) % m -        if tmp == 0: -            return i -    return -1 - - -acc = "7" * 50000000 -if k % 2 == 0: -    ans = -1 -else: -    ans = isMultiple(acc, k) -    if ans != -1: -        ans += 1 +ans = -1 +acc = 7 % k +for n in range(1, k + 10): +    if acc == 0: +        ans = n +        break +    acc = (10 * acc + 7) % k