Buggy python submission (verdict: Runtime Error):
from decimal import*
n = int(input())
a = input().split(" ")
kotae=Decimal(1)
lista = [int(n) for n in a]
for i in range(n):
  kotae*=Decimal(lista[i])
if kotae>10**18:
  kotae=-1
print(int(kotae))
  

Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Buggy python submission (verdict: Runtime Error):
from decimal import*
n = int(input())
a = input().split(" ")
kotae=Decimal(1)
lista = [int(n) for n in a]
for i in range(n):
  kotae*=Decimal(lista[i])
if kotae>10**18:
  kotae=-1
print(kotae)

Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Buggy python submission (verdict: Runtime Error):
from decimal import
n = int(input())
a = input().split(" ")
kotae=Decimal(1)
lista = [int(n) for n in a]
for i in range(n):
  kotae*=Decimal(lista[i])
if kotae>10**18:
  kotae=-1
print(kotae)
  

Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(" ")
lista = [int(n) for n in a]
if 0 in lista:
  print(0)
  exit(0)
else:
  kotae=1
  for i in range(n+1):
    kotae=kotae*lista[i]
    if kotae>10**18:
        print(-1)  
        exit(0)
  print(kotae)


Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(" ")
lista = [int(n) for n in a]
if 0 in lista:
  print(0)
  exit()
kotae=1
while kotae<=10**18:
  for i in range(n+1):
    kotae=kotae*lista[i]
  print(kotae)
  break
print(-1)  
       

Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(" ")
lista = [int(n) for n in a]
if 0 in lista:
  print(0)
  exit()
else:
  kotae=1
  for i in range(n+1):
    kotae=kotae*lista[i]
    if kotae>10**18:
        print(-1)  
        exit()
  print(kotae)


Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(" ")
lista = [int(n) for n in a]
if 0 in lista:
  print(0)
  exit()
kotae=1
for i in range(n+1):
  kotae=kotae*lista[i]
  if kotae>10**18:
    print(-1)
    exit()
print(kotae)


Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = input().split(" ")
lista = [int(n) for n in a]
kotae=1
for i in range(n):
  kotae=kotae*lista[i]
if kotae>10**18:
  print(-1)
else:
  print(kotae)

Fixed submission:
n = int(input())
a = input().split(" ")
kotae=1
listaa = [int(n) for n in a]
lista = sorted(listaa)
if lista[0]==0:
  print(0)
  exit()
for i in range(n):
  kotae*=lista[i]
  if kotae>10**18:
    kotae=-1
    break
if kotae>10**18:
  kotae=-1
print(kotae)