K = int(input())

if K % 7 == 0:
    K //= 7

L = 9 * K

ans = -1

r = 10

for i in range(L):
    r %= L
    if r == 1:
        ans = i + 1
        break
    else:
        r = 10 * r

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

if K % 7 == 0:
    K //= 7

L = 9 * K

ans = -1

r = 10

for i in range(L):
    r %= L
    if r == 1:
        ans = i + 1
        break
    else:
        r = 10 * r

print(ans)