def resolve():
    k = int(input())
    x = 7 % k
    for i in range(1, k + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % k

    print(-1)

resolve() def resolve():
    k = int(input())
    x = 7 % k
    for i in range(1, k + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % k

    print(-1) resolve k = int(input()) k int(input()) int input() input x = 7 % k x 7 % k 7 k for i in range(1, k + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % k

     i range(1, k + 1) range 1 k + 1 k 1 if x == 0:
            print(i)
            return
         x == 0 x 0 print(i) print i return x = (x * 10 + 7) % k x (x * 10 + 7) % k x * 10 + 7 x * 10 x 10 7 k print(-1) print -1 resolve() resolve def resolve():
    k = int(input())
    x = 7 % k
    for i in range(1, k + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % k

    print(-1) def resolve():
    k = int(input())
    x = 7 % k
    for i in range(1, k + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % k

    print(-1) resolve
def resolve():
    k = int(input())
    x = 7 % k
    for i in range(1, k + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % k

    print(-1)

resolve()