ans = -1
a = 0
K = int(input())
if K % 2 == 0:
    ans = -1
elif K % 5 == 0:
    ans = -1
else:
    for i in range(0, K):
        a = (10 * a + 7) % K
        if a == 0:
            ans = i + 1
            break
print(ans) ans = -1 ans -1 a = 0 a 0 K = int(input()) K int(input()) int input() input if K % 2 == 0:
    ans = -1
elif K % 5 == 0:
    ans = -1
else:
    for i in range(0, K):
        a = (10 * a + 7) % K
        if a == 0:
            ans = i + 1
            break K % 2 == 0 K % 2 K 2 0 ans = -1 ans -1 elif K % 5 == 0:
    ans = -1 K % 5 == 0 K % 5 K 5 0 ans = -1 ans -1 for i in range(0, K):
        a = (10 * a + 7) % K
        if a == 0:
            ans = i + 1
            break i range(0, K) range 0 K a = (10 * a + 7) % K a (10 * a + 7) % K 10 * a + 7 10 * a 10 a 7 K if a == 0:
            ans = i + 1
            break a == 0 a 0 ans = i + 1 ans i + 1 i 1 break print(ans) print ans ans = -1 -1 ans ans = -1 -1 ans a = 0 0 a a = (10 * a + 7) % K (10 * a + 7) % K a ans = i + 1 i + 1 ans ans = -1 -1 ans K = int(input()) int(input()) K
ans = -1
a = 0
K = int(input())
if K % 2 == 0:
    ans = -1
elif K % 5 == 0:
    ans = -1
else:
    for i in range(0, K):
        a = (10 * a + 7) % K
        if a == 0:
            ans = i + 1
            break
print(ans)