Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a=7
i=1
if k%5==0 or k%2==0:
  print(-1)
  exit()
while True:
  if a%k ==0:
    print(i)
    exit()
  i+=1
  a = a + 7*10**(i-1)

Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a=7
i=1
if k%5==0 or k%2==0:
  print(-1)
  exit()
while True:
  if a%k ==0:
    print(i)
    break
  i+=1
  a = a + 7*10**(i-1)


Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a=7
i=1
while True:
  if a%k ==0:
    print(i)
    break
  i+=1
  a = a + 7*10**(i-1)

Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a =7
for i in range(k+1):
  if a%k ==0:
    print(i+1)
    break
  i +=1
  a = a + 7*10**(i)
else:
  print("-1")


Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a =7
for i in range(k+1):
  if a%k ==0:
    print(i+1)
    break
  i +=1
  a = a + 7*10**(i)
else:
  print("-1")


Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a =7
for i in range(20000):
  if a%k ==0:
    print(i+1)
    break
  i +=1
  a = a + 7*10**(i)
else:
  print("-1")

 

Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a=7
i=1
while i <= 20000:
  if a%k ==0:
    print(i)
    break
  elif i==20000 and a%k !=0:
    print("-1")
    break
  i+=1
  a = a + 7*10**(i-1)


Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a=7
i=1
while i <= 30000:
  if a%k ==0:
    print(i)
    break
  elif i==30000 and a%k !=0:
    print("-1")
    break
  i+=1
  a = a + 7*10**(i-1)


Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
a=7
i=1
while i <= 10000000:
  if a%k ==0:
    print(i)
    break
  elif k%2 ==0:
    print("-1")
    break
  elif k%5 ==0:
    print("-1")
    break
  i+=1
  a = a + 7*10**(i-1)


Fixed submission:
k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1