k = int(input())
if k%2 == 0 or k%5 == 0:
    print(-1)
    exit()

i = 0
mod = 0
while True:
    mod = (mod*10 + 7)%k
    i += 1
    if mod == 0:
        print(i)
        break k = int(input()) k int(input()) int input() input if k%2 == 0 or k%5 == 0:
    print(-1)
    exit() k%2 == 0 or k%5 == 0 k%2 == 0 k%2 k 2 0 k%5 == 0 k%5 k 5 0 print(-1) print -1 exit() exit i = 0 i 0 mod = 0 mod 0 while True:
    mod = (mod*10 + 7)%k
    i += 1
    if mod == 0:
        print(i)
        break True mod = (mod*10 + 7)%k mod (mod*10 + 7)%k mod*10 + 7 mod*10 mod 10 7 k i += 1 i 1 if mod == 0:
        print(i)
        break mod == 0 mod 0 print(i) print i break i = 0 0 i k = int(input()) int(input()) k i += 1 1 i mod = (mod*10 + 7)%k (mod*10 + 7)%k mod mod = 0 0 mod
k = int(input())
if k%2 == 0 or k%5 == 0:
    print(-1)
    exit()

i = 0
mod = 0
while True:
    mod = (mod*10 + 7)%k
    i += 1
    if mod == 0:
        print(i)
        break