def check7s(k):
    x = 7 % k
    for i in range(1, k + 1):
        if x == 0: return i

        x = (x * 10 + 7) % k
 
    return -1

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

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

        x = (x * 10 + 7) % k
 
     i range(1, k + 1) range 1 k + 1 k 1 if x == 0: return i

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

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

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

        x = (x * 10 + 7) % k
 
    return -1

K = int(input())
print(check7s(K))