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