K = int(input())

val = 7 % K

ans = -1
for i in range(1, 10**6):
    if val == 0:
        ans = i
        break
    val = (val * 10 + 7) % K

print(ans) K = int(input()) K int(input()) int input() input val = 7 % K val 7 % K 7 K ans = -1 ans -1 for i in range(1, 10**6):
    if val == 0:
        ans = i
        break
    val = (val * 10 + 7) % K i range(1, 10**6) range 1 10**6 10 6 if val == 0:
        ans = i
        break
     val == 0 val 0 ans = i ans i break val = (val * 10 + 7) % K val (val * 10 + 7) % K val * 10 + 7 val * 10 val 10 7 K print(ans) print ans val = 7 % K 7 % K val ans = i i ans K = int(input()) int(input()) K ans = -1 -1 ans val = (val * 10 + 7) % K (val * 10 + 7) % K val
K = int(input())

val = 7 % K

ans = -1
for i in range(1, 10**6):
    if val == 0:
        ans = i
        break
    val = (val * 10 + 7) % K

print(ans)