Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = list(map(int,input().split()))
n = 1
m = 1
aa = a/2

c = 0
d = 0

if a%2 == 1:
    aa = (aa*2+1)//2

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()
    
for i in range(int(aa)):
  n = n * b[i]

for i in range(int(aa),a):
    m *= b[i]

if n * m <= 10**18:
    print(n*m)
    exit()
  
print('-1')

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = list(map(int,input().split()))
n = 1
m = 1
aa = a/2

c = 0
d = 0

if a%2 == 1:
    aa = (aa*2+1)//2

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()
    
for i in range(int(aa)):
  n = n * b[i]

for i in range(int(aa),a):
    m *= b[i]

if n * m <= 10**18:
    print(n*m)
    exit()
  
print('-1')


Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = list(map(int,input().split()))
n = 1
m = 1
aa = a/2

c = 0
d = 0

if a%2 == 1:
    aa = (aa*2+1)//2

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()
    
for i in range(int(aa)):
  n = n * b[i]

for i in range(int(aa),a):
    m *= b[i]

if n * m <= 10**18:
    print(n*m)
    exit()
  
print('-1')

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = list(map(int,input().split()))
n = 1
m = 1
aa = a/2

if a%2 == 1:
    aa = (aa*2+1)//2

for i in range(int(aa)):
  n = n * b[i]
  if n == 0:
      print(0)
      exit()
  
for i in range(int(aa),a):
    m *= b[i]
    if m == 0:
      print(0)
      exit()

if n * m <= 10**18:
    print(n*m)
    exit()
  
print('-1')

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
a = int(input())
b = list(map(int,input().split()))

n = 1
m = 1

aa = a/2

if a%2 == 1:
    aa = (aa*2+1)//2

for i in range(int(aa)):
  n = n * b[i]
  
for i in range(int(aa),a):
    m *= b[i]

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

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
a = int(input())
b = list(map(int,input().split()))

n = 1
m = 1

aa = a/2

if a%2 == 1:
    aa = (aa*2+1)//2

for i in range(int(aa)):
  n = n * b[i]
  
  
for i in range(int(aa),a):
    m *= b[i]
    

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

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

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

n = 1


for i in range(a):
  n = n * b[i]

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

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

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

n = 1
  
for i in range(a):
  n = n * b[i]

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


Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = []
n = 1
for i in range(a):
  b.append(int(input()))
  
for i in range(a):
  n = n * b[i]

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

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

for i in b:
  n *= i
  if n > 10**18:
    print(-1)
    exit()
print(n)