#!/usr/bin/env python3

"""

数列777...は奇数故，Kが偶数だったら×



"""

from numba import njit





@njit(cache=True)

def func(a, b):

    return a * b





def main():

    import sys

    input = sys.stdin.readline



    K = int(eval(input()))



    # mod Kを考える(mod=module(剰余))

    x = 7 % K

    for i in range(1, K + 1):

        if x == 0:

            print(i)

            return

        x = (x * 10 + 7) % K

    print((-1))





if __name__ == '__main__':

    main()

# abc173a

def main():

    import sys



    input = sys.stdin.readline



    K = int(eval(input()))



    x = 7 % K

    for i in range(1, K + 1):

        if x == 0:

            print(i)

            return

        x = (x * 10 + 7) % K

    print((-1))





if __name__ == "__main__":

    main()

#!/usr/bin/env python3
"""
数列777...は奇数故，Kが偶数だったら×
"""
from numba import njit


@njit(cache=True)
def func(a, b):
    return a * b


def main():
    import sys

    input = sys.stdin.readline
    K = int(eval(input()))
    # mod Kを考える(mod=module(剰余))
    x = 7 % K
    for i in range(1, K + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % K
    print((-1))


if __name__ == "__main__":
    main()

# abc173a
def main():
    import sys

    input = sys.stdin.readline
    K = int(eval(input()))
    x = 7 % K
    for i in range(1, K + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % K
    print((-1))


if __name__ == "__main__":
    main()

-#!/usr/bin/env python3 -""" -数列777...は奇数故，Kが偶数だったら× -""" -from numba import njit - - -@njit(cache=True) -def func(a, b): -    return a * b - - +# abc173a -    # mod Kを考える(mod=module(剰余))