K = int(input())

num = 0

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

    num %= K

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

    num %= K i range(0,K) range 0 K num = num*10 + 7 num num*10 + 7 num*10 num 10 7 if num % K == 0:
        print(i + 1)
        exit()

     num % K == 0 num % K num K 0 print(i + 1) print i + 1 i 1 exit() exit num %= K num K print(-1) print -1 K = int(input()) int(input()) K num = 0 0 num num %= K K num num = num*10 + 7 num*10 + 7 num
K = int(input())

num = 0

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

    num %= K

print(-1)
