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