Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
if K % 2 == 0 :
    print('-1')
elif K % 5 == 0 :
    print('-1')
else:
    n = 0
    for i in range(1000000):
        n = n * 10 + 7
        if n % K == 0:
            print(i+1)
            break
    else:
        print('-1')


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

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = 7

for i in range(K+1):
    if int(S) % K != 0:
        S = S * 10 + 7
    else:
        print(i+1)
        break

if i >= K:
    print('-1')


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

Buggy python submission (verdict: Runtime Error):
K = int(input())
S = 7

    for i in range(K+1):
        if int(S) % K != 0:
            S = S * 10 + 7
        else:
            print(i+1)
            break

    if i >= K:
        print('-1')


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

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = 7
if (1 <= K) and (K <= (10 ** 6)):

    for i in range(K+1):
        if int(S) % K != 0:
            S = S * 10 + 7
        else:
            print(i+1)
            break

    if i >= K:
        print('-1')

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

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = 7
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:
        if int(S) % K != 0:
            S = S * 10 + 7
            i += 1
        else:
            print(i)
            break

        if i > K:
            print('-1')
            break

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

Buggy python submission (verdict: Runtime Error):
K = input()
S = 7
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:
        if int(S) % K != 0:
            S = S * 10 + 7
            i += 1
        else:
            print(i)
            break

        if i > K:
            print('-1')
            break

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

Buggy python submission (verdict: Runtime Error):
K = input()
S = 7
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:
        if int(S) % K != 0:
            S = S * 10 + 7
            i += 1
        else:
            print(i)
            break

        if i > K:
            print(-1)
            break

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

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = 7
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:

        if int(S) % K != 0:
            S = S * 10 + 7
            i += 1
        elif i > K:
            break
        else:
            break
    print(i)
else:
    pass

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

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = 7
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:

        if int(S) % K != 0:
            S = S * 10 + 7
            i += 1
        elif i > K:
            break
        else:
            break
    print(i)
else:
    print('"K" is out of range!')


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

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = '7'
i = 1
if (1 <= K) and (K <= (10 ** 6)):
    while True:

        if int(S) % K != 0:
            S += '7'
            i += 1
        elif i > K:
            break
        else:
            break
    print(i)
else:
    print('"K" is out of range!')

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

Buggy python submission (verdict: Time Limit Exceeded):

K = int(input())
S = '7'
i = 1
try:
    if (1 <= K) and (K <= (10 ** 6)):
        while True:

            if int(S) % K != 0:
                S += '7'
                i += 1
            else:
                break
        print(i)
    else:
        print('"K" is out of range!')
except Exception as e:
    print(e)


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

Buggy python submission (verdict: Time Limit Exceeded):

K = int(input())
S = '7'
i = 1
if (1 <= K) and (10 ** 6):
    while True:

        if int(S) % K != 0:
            S += '7'
            i += 1
        else:
            break

print(i)


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