K = int(input())

a = [0] * K
a[0] = 7 % K

for i in range(1, K):
    a[i] = (a[i-1] * 10 + 7) % K

ans = -1
for i in range(K):
    if a[i] == 0:
        ans = i + 1
        break

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

a = [0] * K
a[0] = 7 % K

for i in range(1, K):
    a[i] = (a[i-1] * 10 + 7) % K

ans = -1
for i in range(K):
    if a[i] == 0:
        ans = i + 1
        break

print(ans)
