# Respect
K = int(input())
ans = 0
rem = 0
for i in range(K):
    rem = (10*rem + 7)%K
    if rem == 0:
        print(ans+1)
        quit()
    ans += 1
print(-1) K = int(input()) K int(input()) int input() input ans = 0 ans 0 rem = 0 rem 0 for i in range(K):
    rem = (10*rem + 7)%K
    if rem == 0:
        print(ans+1)
        quit()
    ans += 1 i range(K) range K rem = (10*rem + 7)%K rem (10*rem + 7)%K 10*rem + 7 10*rem 10 rem 7 K if rem == 0:
        print(ans+1)
        quit()
     rem == 0 rem 0 print(ans+1) print ans+1 ans 1 quit() quit ans += 1 ans 1 print(-1) print -1 rem = 0 0 rem ans += 1 1 ans ans = 0 0 ans rem = (10*rem + 7)%K (10*rem + 7)%K rem K = int(input()) int(input()) K
# Respect
K = int(input())
ans = 0
rem = 0
for i in range(K):
    rem = (10*rem + 7)%K
    if rem == 0:
        print(ans+1)
        quit()
    ans += 1
print(-1)