k = int(input())

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

ans = -1
x = 7%k
for n in range(1,k+10):
    if x == 0:
        ans = n
        break
    x = (10*x+7)%k
print(ans)