k = int(input())

num = 7 % k
ans = 1
mod = [0 for _ in range(k)]
mod[num] = 1
while(num):
    num = (num * 10 + 7) % k
    if mod[num] > 0:
        ans = -1
        break
    ans += 1
    mod[num] += 1

print(ans) k = int(input()) k int(input()) int input() input num = 7 % k num 7 % k 7 k ans = 1 ans 1 0 for _ in range(k) for _ in range(k) _ range(k) range k for _ in range(k) 0 mod = [0 for _ in range(k)] mod [0 for _ in range(k)] mod[num] = 1 mod[num] mod num 1 while(num):
    num = (num * 10 + 7) % k
    if mod[num] > 0:
        ans = -1
        break
    ans += 1
    mod[num] += 1 num num = (num * 10 + 7) % k num (num * 10 + 7) % k num * 10 + 7 num * 10 num 10 7 k if mod[num] > 0:
        ans = -1
        break
     mod[num] > 0 mod[num] mod num 0 ans = -1 ans -1 break ans += 1 ans 1 mod[num] += 1 mod[num] mod num 1 print(ans) print ans num = (num * 10 + 7) % k (num * 10 + 7) % k num ans += 1 1 ans num = 7 % k 7 % k num k = int(input()) int(input()) k ans = 1 1 ans ans = -1 -1 ans mod = [0 for _ in range(k)] [0 for _ in range(k)] mod
k = int(input())

num = 7 % k
ans = 1
mod = [0 for _ in range(k)]
mod[num] = 1
while(num):
    num = (num * 10 + 7) % k
    if mod[num] > 0:
        ans = -1
        break
    ans += 1
    mod[num] += 1

print(ans)
