K = int(input())

ans = -1
mod = 7%K
for i in range(1000001):
    if mod==0:
        ans = i+1
        break
    else:
        mod = (mod*10+7)%K
        
print(ans) K = int(input()) K int(input()) int input() input ans = -1 ans -1 mod = 7%K mod 7%K 7 K for i in range(1000001):
    if mod==0:
        ans = i+1
        break
    else:
        mod = (mod*10+7)%K
         i range(1000001) range 1000001 if mod==0:
        ans = i+1
        break
    else:
        mod = (mod*10+7)%K
         mod==0 mod 0 ans = i+1 ans i+1 i 1 break mod = (mod*10+7)%K mod (mod*10+7)%K mod*10+7 mod*10 mod 10 7 K print(ans) print ans K = int(input()) int(input()) K mod = (mod*10+7)%K (mod*10+7)%K mod ans = i+1 i+1 ans ans = -1 -1 ans mod = 7%K 7%K mod
K = int(input())

ans = -1
mod = 7%K
for i in range(1000001):
    if mod==0:
        ans = i+1
        break
    else:
        mod = (mod*10+7)%K
        
print(ans)