CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

result = 1
for a in A:
  result *= a

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

# Optimized solution
import sys

N = int(eval(input()))
A = list(map(int, input().split()))

if 0 in A:
    print((0))
    sys.exit()

result = 1
for a in list(A):
    result *= a
    if (result > 10 ** 18):
        print((-1))
        sys.exit()

print(result)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

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

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

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

if 0 in a:
    print((0))
    exit(0)

acc = 1
for i in range(n):
    acc *= a[i]
    if acc > 10 ** 18:
        print((-1))
        exit(0)

print(acc)
# Original solution
n = int(eval(input()))

nums = list(map(int, input().split()))

ans = 1

for num in nums:
  ans *= num
  
if ans > 10 ** 18:
  print((-1))
else:
  print(ans)

# Optimized solution
n = int(eval(input()))

MAX_NUM = 10 ** 18

nums = list(map(int, input().split()))

for num in nums:
  if num == 0:
    print((0))
    exit()

ans = 1
for num in nums:
  ans *= num
  if ans > MAX_NUM:
    print((-1))
    exit()

print(ans)
# Original solution
from operator import mul
from functools import reduce
n=int(eval(input()))
lis=list(map(int,input().split()))
ans=reduce(mul,lis)
if ans>1000000000000000000:
    print((-1))
else:
    print(ans)

# Optimized solution
n=int(eval(input()))
lis=list(map(int,input().split()))
ans=1
for i in lis:
    ans*=i
    if ans>1000000000000000000:
        ans=-1
        break
if 0 in lis:
    ans=0

print(ans)
# Original solution
#b問題
n=int(eval(input()))
ans=1
a=list(int(y) for y in input().split())
# print(a)
if 0 in a:
    print((0))
else:
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            ans=-1
    print(ans)

# Optimized solution
#b問題
n=int(eval(input()))
ans=1
a=list(int(y) for y in input().split())
# print(a)
if 0 in a:
    print((0))
else:
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            ans=-1
            break
    print(ans)
# Original solution
def main():    
    t =  int(eval(input()))
    n = 1
    a = list(map(int,input().strip().split()))[:t]
    for i in range(t):
        n*=a[i]
    if n>1e18:
        print((-1))
    else:
        print(n)
        
if __name__ == '__main__':
    main()

# Optimized solution
def main():    
    t =  int(eval(input()))
    n = 1
    a = list(map(int,input().strip().split()))[:t]
    for i in range(t):
        if a[i]==0:
            return 0
    for i in range(t):
        n*=a[i]
        if n>1e18:
            return -1
    if n>1e18:
        return -1
    else:
        return n
        
if __name__ == '__main__':
    print((main()))
# Original solution
over = 10**18

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1;

for i in range(n):
  if a[i] == 0:
    ans = 0
if not ans == 0:
  for i in range(n):
    ans = ans * a[i]
    if ans > over:
      ans = -1
if ans < 0:
  print((-1))
else:
  print(ans)


# Optimized solution
over = 10**18

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1;

for i in range(n):
  if a[i] == 0:
    ans = 0
if not ans == 0:
  for i in range(n):
    ans = ans * a[i]
    if ans > over:
      ans = -1
      break
if ans < 0:
  print((-1))
else:
  print(ans)
# Original solution
n=int(eval(input()))
A=list(map(int,input().split()))

ans=1
for i in range(n):
    ans *=A[i]
if ans>10**18:print((-1));exit()
print(ans)

# Optimized solution
n=int(eval(input()))
A=list(map(int,input().split()))

ans=1
if 0 in A:print((0));exit()
for i in range(n):
    ans *=A[i]
    if ans>10**18:print((-1));exit()
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
ans = 1
ju = 0
for i in range(n):
    ans = ans*a[i]


if ans<=10**18:
    print(ans)
else:
    print((-1))


# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
ans = 1
ju = 0
j = 0
if 0 in a:
    ju=1

for i in range(n):
    ans = ans*a[i]
    if ans>10**18:
        j = 1
        break

if ju==1:
    print((0))
elif j==1:
    print((-1))
else:
    print(ans)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans=1
for i in range(n):
    ans=a[i]*ans

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

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))

a.sort()
if a[0]==0:
    print((0))
else:
    a.sort(reverse=True)
    # print(a)

    ans=1
    for i in range(n):
        ans=a[i]*ans
        if ans>10**18:
            break

    if ans>10**18:
        print((-1))
    else:
        print(ans)
# Original solution
from operator import mul
from functools import reduce

N = int(eval(input()))
A = list(map(int, input().split()))

ans = reduce(mul, A)
if ans > 10**18: ans = -1

print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

ans = 1
if 0 in A:
    ans = 0
else:
    for i in A:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
print(ans)
# Original solution
from functools import reduce
def do():
    n=int(eval(input()))
    l=list(map(int,input().split()))
    # k=1
    v=reduce(lambda x, y: x*y, l)
    if v > 1 * 10 ** 18:
        return -1
    return v
print((do()))


# Optimized solution
def do():
    n=int(eval(input()))
    l=list(map(int,input().split()))
    k=1
    if 0 in l:
        return 0
    for i in l:
        k*=i
        if k>1*10**18:
            return -1
    return k
print((do()))
# Original solution
N = int(eval(input()))
line = input().split()

MAX = 1000000000000000000

ans = 1

for l in line:
    ans = int(l) * ans

if ans <= MAX:
    print(ans)
else:
    print((-1))


# Optimized solution
N = int(eval(input()))
line = input().split()

MAX = 1000000000000000000

ans = 1

if not '0' in line:
    for l in line:
        if l == 0:
            ans = 0
            break
        if not ans > MAX:
            ans = int(l) * ans

else:
    ans = 0


if ans <= MAX:
    print(ans)
else:
    print((-1))
# Original solution
N = int(eval(input()))
c = 1
a = list(map(int,input().split()))
for i in range(N):
  c *= a[i]
  if i == N-1:
    if c > 1000000000000000000:
      print((-1))
      break
    else :
      print(c)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
c = 1

if 0 in A:
  print((0))
  exit()

for i in range(N):
  c *= A[i]
  if c > 10 ** 18:
    print((-1))
    exit()
print(c)
# Original solution
from functools import reduce
from operator import mul
N = int(input())
numList = list(map(int, input().split()))
ans = reduce(mul, numList)
print(ans) if ans <= 10**18 else print("-1")


# Optimized solution
import collections

N = int(eval(input()))
cNum = collections.Counter(list(map(int, input().split())))
ans = 1
if cNum[0] != 0:
  print("0")
  exit()
for n in list(cNum.keys()):
  ans *= n**cNum[n]
  if ans > 10**18:
    ans = -1
    break
print(ans)
# Original solution
n = int(eval(input()))
up = int("1"+"0"*18)

a = list(map(int, input().split()))
ans = a[0]

for i in range(1, len(a)):
    if (0 in a):
        ans = 0
        break
    
    ans = ans * a[i]

    if (ans > up):
        ans = -1
        break

print(ans)


# Optimized solution
n = int(eval(input()))
up = int("1"+"0"*18)

a = list(map(int, input().split()))
ans = a[0]

def calc(a):
    x = ans
    for i in range(1, len(a)):
        x = x * a[i]

        if (x > up):
            x = -1
            return x

    return x

if (0 in a):
    ans = 0
else:
    ans = calc(a)

print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
total = 1
for i in range(N):
  total *= A[i]
if total > 1e18:
  print((-1))
else:
  print(total)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
total = 1
if 0 in A:
  print((0))
  exit()
for i in range(N):
  total *= A[i]
  if total > 1e18:
    print((-1))
    exit()
print(total)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
i=0
division=1
for i in range(0,N):
    division=division*A[i]
    i+=1
if division<=10**18:
    print(division)
if division>10**18:
    print("-1")

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
i=0
division=1
if 0 in A:
    print((0))
else:
    for i in range(0,N):
        division=division*A[i]
        i+=1
        if division>10**18:
            print("-1")
            break
    if 0<division<=10**18:
        print(division)
# Original solution
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 1
for i in l:
    ans *= i
if ans > 10 ** 18: ans = -1
print(ans)


# Optimized solution
n = int(eval(input()))
l = list(map(int, input().split()))
ans = 1
for i in l:
    if i == 0:
        print((0))
        exit()
for i in l:
    ans *= i
    if ans > 10 ** 18: 
        ans = -1
        break
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
judge = True
ans = 1
for i in a:
    ans *= i
    if (ans > 1000000000000000000):
        judge = False

if judge:
    print(ans)
else:
    print((-1))


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
judge = True
ans = 1
for i in a:
    ans *= i
    if (ans > 1000000000000000000):
        judge = False
        break

if judge:
    print(ans)
else:
    print((-1))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

T = 1
for i in A:
    T = T * i
if T > 10 ** 18:
    print((-1))
else:
    print(T)


# Optimized solution
n = int(eval(input()))
list = list(map(int, input().split()))

a = 1
if 0 in list:
    print((0))
    exit()
else:
    for i in list:
        a *= i
        if a > 10**18:
            print((-1))
            exit()
print(a)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
x = 1

for i in range(n):
    x = x*a[i]
    
if x > 10**18:
    print('-1')

else:
    print(x)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
x = 1

a = sorted(a)

if a[0]==0:
    print((0))

else:
    for i in range(n):
        x = x*a[i]
    
        if x > 10**18:
            print('-1')
            break
        if i == n-1:
            print(x)
            break
# Original solution
import operator
from functools import reduce

n = int(eval(input()))

a = [int(x) for x in input().split()]


sum = reduce(operator.mul, a, 1)


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



# Optimized solution
n = int(eval(input()))

a = [int(x) for x in input().split() ]
sum = a[0]

if 0 in a:
        sum = 0
else:
    for i in range(1,len(a)):
        sum = sum * a[i]
        if sum > 10**18:
            break
        


if sum > 10**18:
    print((-1))
else:
    print(sum)
# Original solution
N = int(input())
arr = list(map(int, input().split()))
INF = 10 ** 18
ans = 1
for num in arr:
    ans *= num
 
print(ans) if ans <= INF else print(-1)


# Optimized solution
N = int(eval(input()))
arr = sorted(map(int, input().split()))
INF = 10 ** 18
ans = 1
for num in arr:
    ans *= num
    if num > 0 and ans > INF:
        ans = -1
        break
    elif ans == 0:
        break

print(ans)
# Original solution
N = int(eval(input()))
num = 1
flag = 0
c=[int(i) for i in input().split()]
for i in c:
    if i == 0:
        flag = 1
        print("0")
if flag == 0:
    for i in c:
        num *= i
        if num > 1000000000000000000:
            print("-1")
            flag =1
            break
if flag == 0:
    
    print(num)

# Optimized solution
N = int(eval(input()))
num = 1
flag = 0
c=list(map(int, input().split()))
for i in c:
    if i == 0:
        flag = 1
        print("0")
if flag == 0:
    for i in c:
        num *= i
        if num > 1000000000000000000:
            print("-1")
            flag =1
            break
if flag == 0:

    print(num)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
ans=1
way=0
for i in A:
    ans*=i
way=str(ans-1)
if(len(way)>=19):
    ans=-1
else:
    pass
print(ans)

# Optimized solution
def quick_sort(list):
    stand=list[0]
    over=[]
    same=[]
    under=[]
    for i in list:
        if(i>stand):
            over.append(i)
        elif(i<stand):
            under.append(i)
        else:
            same.append(i)
    if(len(over)>1):
        over=quick_sort(over)
    else:
        pass
    if(len(under)>1):
        under=quick_sort(under)
    else:
        pass

    return under+same+over

N=int(eval(input()))
A=list(map(int,input().split()))
A=quick_sort(A)
ans=1
way=0
for i in A:
    ans*=i
    way=str(ans-1)
    if(len(way)>=19):
        ans=-1
        break
    else:
        pass
print(ans)
# Original solution
import functools
import operator
 
N = int(eval(input()))
mylist = list(map(int,input().split()))
Π = functools.partial(functools.reduce, operator.mul)
ans = (Π(mylist))
if ans <= 10**18:
    print(ans)
else:
    print((-1))

# Optimized solution
import math
import sys
N = int(eval(input()))
mylist = list(map(int, input().split()))
mylist.sort(reverse = True)
#print(mylist)
if mylist[-1] == 0:
    print((0))
    sys.exit()
else:
    myans = 1
    for m in mylist:
        myans *= m
        if myans > 10**18:
            print((-1))
            sys.exit()
    print(myans)
# Original solution
import sys
n = eval(input())
data = list(map(int, sys.stdin.readline().split()))

ans = 1

over=False
zero=False
for num in data:
    ans*=num
    if(ans>1000000000000000000):
        over=True
    if(num == 0):
        zero=True

if ans>1000000000000000000:
    over=True

if zero:
    print("0")
elif over:
    print("-1")
else:
    print(ans)

# Optimized solution
import sys
n = eval(input())
data = list(map(int, sys.stdin.readline().split()))

ans = 1

over=False
zero=False

if 0 in data:
    zero=True

for num in data:
    ans*=num
    if(ans>1000000000000000000):
        over=True
        break

if ans>1000000000000000000:
    over=True

if zero:
    print("0")
elif over:
    print("-1")
else:
    print(ans)
# Original solution
n = eval(input())
a = list(map(int, input().split()))
sum = 1
for i in a:
  sum *= i

if sum > 10**18:
  sum = -1
print(sum)

# Optimized solution
n = eval(input())
a = input().split()
a = [int(s) for s in a]
a.sort(reverse=True)

if a[-1] == 0:
  print((0))
else :
  sum = 1
  for i in a:
    sum *= i
    if sum > 10**18:
      sum = -1
      break
  print(sum)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
v = 1
for i in a: 
    v *= i
if v > 10 ** 18:
    v = -1
print(v)

# Optimized solution
import sys
n = int(eval(input()))
a = list(map(int, input().split()))
v = 1
if 0 in a:
    print((0))
    sys.exit(0)
for i in a: 
    v *= i
    if v > 10 ** 18:
        v = -1
        break
print(v)
# Original solution
N=int(eval(input()))
li=list(map(int,input().split()))
 
m=li[0]
if 0 in li:
  print((0))
else:
  for i in range(1,N):
    m=m*li[i]
    if m>10**18:
      m=-1
      
  print(m)
  


# Optimized solution
N=int(eval(input()))
li=list(map(int,input().split()))
 
m=li[0]
if 0 in li:
  m=0
else:
  for i in range(1,N):
    m=m*li[i]
    if m>10**18:
      m=-1
      break
print(m)
# Original solution
N=int(eval(input()))
a_list = list(map(int, input().split()))
res = 1
for a in a_list:
    res *= a

print((res if res <= 10**18 else -1))

# Optimized solution
N=int(eval(input()))
a_list = list(map(int, input().split()))

if 0 in a_list:
    print((0))
    exit()

res = 1
for a in a_list:
    res *= a
    if res > 10**18:
        print((-1))
        exit()

print(res)
# Original solution
n = int(eval(input()))

ans = 1

for e in map(int, input().split()):
    ans *= e

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


# Optimized solution
n = int(eval(input()))

a = [*list(map(int, input().split()))]
for e in a:
    if e == 0:
        print((0))
        exit(0)

ans = 1
for e in a:
    ans *= e
    if ans > 10**18:
        print((-1))
        exit(0)

print(ans)
# Original solution
N=int(eval(input()))
A=[int(i) for i in input().split(" ")]
mul=1
for a in A:
    mul*=a

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


# Optimized solution
import sys
N=int(eval(input()))
A=[int(i) for i in input().split(" ")]
if 0 in A:
    print((0))
    sys.exit(0)
A=sorted(A,reverse=True)
mul=1
for a in A:
    mul*=a

    if mul>10**18:
        print((-1))
        sys.exit(0)

print(mul)
# Original solution
#coding:utf-8

N = int(eval(input()))

A = [int(i) for i in input().split()]

ans = 1

for i in A:
    ans = ans * i
    
if ans > (10 ** 18) :
    ans = -1
    

print(("{}".format(ans)))

# Optimized solution
#coding:utf-8

N = int(eval(input()))

A = [int(i) for i in input().split()]

ans = 1
flag = True

for i in A:
    if i == 0:
        ans = 0
        flag = False

if flag:
    for i in A:
        ans = ans * i
        if ans > (10 ** 18):
            ans = -1
            break   

print(("{}".format(ans)))
# Original solution
N = int(eval(input()))
A  = [int(x) for x in input().split()]
total = 1
for a in A:
    total *= a 

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

# Optimized solution
N = int(eval(input()))
A  = [int(x) for x in input().split()]
total = 1
if 0 in A:
    print((0))
else:    
    for a in A:
        total *= a 
        if total > 10 ** 18:
            print((-1))
            break

    if total <= 10 ** 18:
        print(total)
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))
b = 1
for i in range(N):
  b *= a[i]
  if 0 in a:
    b = 0
    break
  elif b > 10 ** 18:
    b = 'out'
    break
if b == 'out':
  print((-1))
else:
  print(b)


# Optimized solution
import sys
n = eval(input())
list_num =list(map(int,input().split()))
output = 1
if 0 in list_num:
    print((0))
    sys.exit()
for i in list_num:
    output = output * i
    if output > 10 ** 18:
        print((-1))
        sys.exit()
print(output)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = 1

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

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

else:
    print(ans)

# Optimized solution
n = int(eval(input()))
a = input().split()

ans = 1

for i in range(n):
    ans *= int(a[i])
    if ans > 10**18:
        if "0" in a:
            print((0))
            exit()
        else:
            print((-1))
            exit()

print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1

for num in A:
    ans *= num

if ans > 1e18:
    ans = -1

print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1

if 0 in A:
    ans = 0
else:
    for num in A:
        ans *= num
        if ans > 1e18:
            ans = -1
            break

print(ans)
# Original solution
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    n = int(input())
    x = list(map(int, input().split()))
    ans = 1
    for i in range(len(x)):
        ans *= x[i]
    if ans > 10**18:
        print('-1')
    else:
        print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)


# Optimized solution
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    n = int(input())
    x = list(map(int, input().split()))
    ans = 1
    if 0 in x:
        print('0')
        return
    for i in range(len(x)):
        ans *= x[i]
        if ans > 10**18:
            print('-1')
            return
    print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)
# Original solution
n = int(eval(input()))
li = list(map(int, input().split()))
a = 1
if 0 in li:
    print((0))
    quit()
else:
    for x in li:
        a *= x
    if a > 10**18:
        print((-1))
        quit()
    print(a)

# Optimized solution
n = int(eval(input()))
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    print((0))
    quit()
for x in ls:
    res *= x
    if res > 10**18:
        print((-1))
        quit()
print(res)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
ans=1
for i in range(N):
    ans=ans*A[i]
print((ans if ans<=10**18 else -1))

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
ans=1
if 0 in A:
    print((0))
    exit()
for i in range(N):
    ans=ans*A[i]
    if ans>10**18:
        print((-1))
        exit()
print(ans)
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
ans = x[0]
if 0 in x:
	ans = 0
else:
	for i in range(1,n):
		ans = ans * x[i]
		if ans > 10 ** 18:
			ans = -1
print(ans)

# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))
ans = x[0]
if 0 in x:
	ans = 0
else:
	for i in range(1,n):
		ans = ans * x[i]
		if ans > 10 ** 18:
			ans = -1
			break
print(ans)
# Original solution
n = int(eval(input()))
t = list(map(int, input().split()))
to = t[0]
if 0 in t:
  print((0))
  exit()
for a in t[1:]:
	to *= a
if to > 10**18:
	print("-1")
else:
  print(to)

# Optimized solution
n = int(eval(input()))
t = list(map(int, input().split()))
to = t[0]
if 0 in t:
  print((0))
  exit()
for a in t[1:]:
    to *= a
    if to > (10**18):
        print("-1")
        exit()
print(to)
# Original solution
from operator import mul
from functools import reduce

border = 10 ** 18

N = int(eval(input()))
nums = list(map(int, input().split()))
result = reduce(mul, nums)

if result > border:
    print((-1))
    exit()
print(result)

# Optimized solution
border = 1000000000000000000

N = int(eval(input()))
nums = list(map(int, input().split()))
if 0 in nums:
    print((0))
    exit()

result = 1
for n in nums:
    result = result * n
    if result > border:
        print((-1))
        exit()
print(result)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans=a[0]
for i in range(1,n):
  ans*=a[i]
print((ans if ans<=10**18 else -1))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
if 0 in a:
  print((0))
  exit()
for aa in a:
  if aa>10**18:
    print((-1))
    exit()
ans=a[0]
for i in range(1,n):
    ans=ans*a[i]
    if ans>10**18:
      print((-1))
      exit()
print(ans)
# Original solution
import sys
N=int(eval(input()))
a=list(map(int, input().split()))
s=1
if 0 in a:
    print((0))
    sys.exit()
for i in a:
    s*=i
if s>10**18:
    print((-1))
    sys.exit()
print(s)

# Optimized solution
import sys
N=int(eval(input()))
a=list(map(int, input().split()))
s=1
# aに0がある場合を省く
if 0 in a:
    print((0))
    sys.exit()
else:
# sが10^18になったら打ち切る
    for i in a:
        if s<10**18:
            s*=i
    if s>10**18:
        print((-1))
        sys.exit()
    print(s)
# Original solution
n=int(eval(input()))
mx=10**18
z=1

a=[int(i) for i in input().split()]
for i in a:
    z*=i

if(z>mx)    : z=-1
print(z)



# Optimized solution
n=int(eval(input()))
mx=10**18
z=1

a=[int(i) for i in input().split()]
for i in a:
    if i==0:
        print((0))
        quit()

for i in a:
    z*=i
    if z>mx:    z=-1
    if z==-1:   break

if z>mx or z<0   : z=-1
print(z)
# Original solution
from operator import*
from functools import*
eval(input())
l = list(map(int, input().split()))
n = reduce(mul, l)
if n > 10**18:
    print((-1))
else:
    print(n)

# Optimized solution
eval(input())
l = list(map(int, input().split()))

n = 1
lim = 10**18
for e in l:
    n *= e
    if n > lim:
        print((0 if 0 in l else -1))
        break
else:
    print(n)
# Original solution
N = int(eval(input()))
A = input().split(" ")
s = 1
for i in range(N):
  s = s*int(A[i])


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

# Optimized solution
N = int(eval(input()))
A = input().split(" ")
s = 1

for i in range(N):
  if int(A[i]) == 0:
    s = 0

for i in range(N):
  if s ==0:
    break
  if s > 10**18:
    break
  s = s*int(A[i])


if s > 10**18:
  print((-1))
else:
  print(s)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
if 0 in a:
    print((0))
    exit()
for i in range(n):
    ans *= a[i]
if ans > 10 ** 18:
    ans = '-1'
print(ans)


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
if 0 in a:
    print((0))
    exit()
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        print((-1))
        exit()
print(ans)