k = int(input())
a = [0] * (10**6+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:
        print(i)
        break
else:
    print(-1) k = int(input()) k int(input()) int input() input a = [0] * (10**6+1) a [0] * (10**6+1) [0] 0 10**6+1 10**6 10 6 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:
        print(i)
        break
else:
    print(-1) i range(1, k+1) range 1 k+1 k 1 if a[i] == 0:
        print(i)
        break a[i] == 0 a[i] a i 0 print(i) print i break print(-1) print -1 k = int(input()) int(input()) k a = [0] * (10**6+1) [0] * (10**6+1) a
k = int(input())
a = [0] * (10**6+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:
        print(i)
        break
else:
    print(-1)
