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

if K%2 == 0 or K%5 ==0:
    print(-1)
    exit(0)

count = 0
an = 0
while True:
  an = 10*an + 7
  count +=1
  if an%K == 0:
    break
print(count)

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

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

if K%2 == 0 or K%2 ==0:
    print(-1)
    exit(0)

count = 0
an = 0
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    break
print(count)

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

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

if K%2 == 0 or K%2 ==0:
    print(-1)
    exit(0)

count = 0
an = 0
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    print(count)
    break

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

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

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)

count = 0
an = 0
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    break
print(count)

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

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

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)

count = 0
an = 0
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    print(count)
    break

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 0
an = 0

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
     break
print(count)

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 0
an = 0

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit()
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    print(count)
    break

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
c = 0
an = 0

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  an = (10*an + 7) % K
  c +=1
  if an == 0:
    print(c)
    break

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 0
an = 0

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    print(count)
    break

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 0
an = 0

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    print(count)
    break

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 0
an = 0

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  an = (10*an + 7) % K
  count +=1
  if an == 0:
    print(count)
    break

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 0
an = 0

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  an = 10*an + 7
  count +=1
  if an % K == 0:
    print(count)
    break


Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 1
an = 7

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  if an % K == 0:
    print(count)
    exit(0)
  an = 10*an + 7
  count +=1


Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
count = 1
an = 7

if K%2 == 0 or K%2 ==0:
    print("-1")
    exit(0)
while True:
  if an % K == 0:
    print(count)
    exit(0)
  an = 10*an + 7
  count +=1


Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Runtime Error):
K = int(input())
x = 7
count = 1

if 7%K==0:
  print("1")
  exit(0)
if 77%==0:
  print("2")
  exit(0)
if 777%==0:
  print("3")
  exit(0)
if 7777%==0:
  print("4")
  exit(0)
if 77777%==0:
  print("5")
  exit(0)
if 777777%==0:
  print("6")
  exit(0)
if 7777777%==0:
  print("7")
  exit(0)
  
print("-1")

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

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

if 7%K==0:
  print("1")
  exit(0)
if 77%==0:
  print("2")
  exit(0)
if 777%==0:
  print("3")
  exit(0)
if 7777%==0:
  print("4")
  exit(0)
if 77777%==0:
  print("5")
  exit(0)
if 777777%==0:
  print("6")
  exit(0)
if 7777777%==0:
  print("7")
  exit(0)
  
print("-1")

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
x = 7
count = 1

if K%2 == 0 or K%5 == 0:
  print("-1")
  exit(0)
for i in range(100000):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
x = 7
count = 1

if K%2 == 0 or K%5 == 0:
  print("-1")
  exit()
for i in range(100000):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
x = 7
count = 1

for i in range(100000):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
x = 7
count = 1
if K % 2 ==0:
  print("-1")
  exit(0)
for i in range(1000000):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
x = 7
count = 1
if K % 2 ==0:
  print("-1")
  exit(0)
for i in range(10**5):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")

Fixed submission:
def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))