K = int(input())

def solve():
    val = 0
    for i in range(1, K + 1):
        val = val * 10 + 7
        val = val % K
        if val == 0:
            return i
    
    return -1

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

def solve():
    val = 0
    for i in range(1, K + 1):
        val = val * 10 + 7
        val = val % K
        if val == 0:
            return i
    
    return -1

print(solve())