k = int(input())
a = [None for i in range(10**7) ]

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

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

print(ans) k = int(input()) k int(input()) int input() input None for i in range(10**7) for i in range(10**7) i range(10**7) range 10**7 10 7 for i in range(10**7) None a = [None for i in range(10**7) ] a [None for i in range(10**7) ] ans = -1 ans -1 a[1] = 7%k a[1] a 1 7%k 7 k for i in range(2,k+1):
    a[i] = (a[i-1]*10 + 7)%k i range(2,k+1) range 2 k+1 k 1 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 for i in range(1,k+1):
    if a[i] == 0:
        ans = i
        break i range(1,k+1) range 1 k+1 k 1 if a[i] == 0:
        ans = i
        break a[i] == 0 a[i] a i 0 ans = i ans i break print(ans) print ans k = int(input()) int(input()) k ans = i i ans a = [None for i in range(10**7) ] [None for i in range(10**7) ] a ans = -1 -1 ans
k = int(input())
a = [None for i in range(10**7) ]

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

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

print(ans)
