import sys
import numpy as np  # noqa
import numba  # noqa
from numba import njit, b1, i4, i8, f8  # noqa

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


@njit((i8, ), cache=True)
def main(K):
    for i in range(K):
        if i == 0:
            a = 7 % K
        else:
            a = (a * 10 + 7) % K
        if a == 0:
            return i + 1

    return -1


K = int(readline())

print(main(K)) import sys sys import numpy as np numpy import numba numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines def main(K):
    for i in range(K):
        if i == 0:
            a = 7 % K
        else:
            a = (a * 10 + 7) % K
        if a == 0:
            return i + 1

    return -1 main for i in range(K):
        if i == 0:
            a = 7 % K
        else:
            a = (a * 10 + 7) % K
        if a == 0:
            return i + 1

     i range(K) range K if i == 0:
            a = 7 % K
        else:
            a = (a * 10 + 7) % K
         i == 0 i 0 a = 7 % K a 7 % K 7 K a = (a * 10 + 7) % K a (a * 10 + 7) % K a * 10 + 7 a * 10 a 10 7 K if a == 0:
            return i + 1

     a == 0 a 0 return i + 1 i + 1 i 1 return -1 -1 K K @njit((i8, ), cache=True) main (i8, ), cache=True @njit((i8, ), cache=True) njit i8 cache=True cache True main K = int(readline()) K int(readline()) int readline() readline print(main(K)) print main(K) main K def main(K):
    for i in range(K):
        if i == 0:
            a = 7 % K
        else:
            a = (a * 10 + 7) % K
        if a == 0:
            return i + 1

    return -1 def main(K):
    for i in range(K):
        if i == 0:
            a = 7 % K
        else:
            a = (a * 10 + 7) % K
        if a == 0:
            return i + 1

    return -1 main readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines read = sys.stdin.buffer.read sys.stdin.buffer.read read K = int(readline()) int(readline()) K readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline
import sys
import numpy as np  # noqa
import numba  # noqa
from numba import njit, b1, i4, i8, f8  # noqa

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


@njit((i8, ), cache=True)
def main(K):
    for i in range(K):
        if i == 0:
            a = 7 % K
        else:
            a = (a * 10 + 7) % K
        if a == 0:
            return i + 1

    return -1


K = int(readline())

print(main(K))
