k = int(input())

def cal(k):
    n = 7
    for i in range(1,10000000):
        if n % k == 0:
            return i
        else:
            n = (n *10 + 7) % k
    return -1

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

def cal(k):
    n = 7
    for i in range(1,10000000):
        if n % k == 0:
            return i
        else:
            n = (n *10 + 7) % k
    return -1

print(cal(k))