Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 1
for i in A:
  if any(j == 0 for j in A) == True:
    ans = 0
    break
  ans *= i
  if ans > 10**18:
    ans = -1
    break

print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in A:
    ans *= A
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 1

for i in range(N):
  if 0 in A:
    ans = 0
    break
  ans *= A[i]
  i += 1
  if ans > 10**18:
    ans = -1
    break

print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 1

for i in range(N):
  if any(j == 0 for j in A) == True:
    print(0)
    break
  ans *= A[i]
  i += 1
  if ans > 10**18:
    print('-1')
    break
  if i == N:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 1

for i in range(N):
  ans *= A[i]
  i += 1

if ans > 10**18:
  print('-1')
else:
  print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int, input().split()))

resultk = 1
for i in range(n):
  resultk = resultk * ls[i]

r = resultk


if r > 10 ** 18:
  print(-1)
else:
  print(r)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int, input().split()))

resultk = 1
for i in range(n):
  resultk = resultk * ls[i]

r = resultk


if r > 10 ** 18:
  print(-1)
else:
  print(r)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)