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