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