K = int(input())

x = 7%K

for i in range(K):
    if x == 0:
        print(i+1)
        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(K):
    if x == 0:
        print(i+1)
        exit()
    x = (x*10+7)%K i range(K) range K if x == 0:
        print(i+1)
        exit()
     x == 0 x 0 print(i+1) print i+1 i 1 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 K = int(input()) int(input()) K x = 7%K 7%K x x = (x*10+7)%K (x*10+7)%K x
K = int(input())

x = 7%K

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