CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
ans = 1
flag = 0
A = list(map(int,input().split()))
for a in A:
    ans *= a

if ans > 1e18:
    print((-1))
else:
    print(ans)



# Optimized solution
n = int(eval(input()))
ans = 1
flag = 0
A = list(map(int,input().split()))
A = list(A)
list.sort(A)
for a in A:
    ans *= a
    if ans == 0:
        print((0))
        flag = 1
        break
    if ans > 1e18:
        print((-1))
        flag = 1
        break

if flag == 0:
    print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
total = 1
maxi = 10 ** 18
for ae in a:
    total *= ae
if total > maxi:
    print((-1))
    exit()
print(total)



# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort(reverse = True)
if a[-1] == 0:
    print((0))
    exit()
total = 1
maxi = 10 ** 18
for ae in a:
    total *= ae
    if total > maxi:
        print((-1))
        exit()
print(total)
# Original solution
from operator import mul
from functools import reduce
n = int(eval(input()))
a = list(map(int, input().split()))
ans = reduce(mul, a)
print((ans if ans <= 10**18 else -1))


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

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

ans = 1
for num in range(N):
    if 0 in A:
        ans = 0
        break
    ans *= A[num]
    if ans > math.pow(10, 18):
        ans = -1
        break

print(ans)

# Optimized solution
import math

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

ans = 1
for num in range(N):
    ans *= A[num]
    if ans > math.pow(10, 18):
        ans = -1
        break

if 0 in A:
    ans = 0

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

a = list(map(int,input().split()))
m = 10 ** 18
ans = 1
for i in range(n):
	ans *= a[i]

if ans > m:
	print((-1))
else:
	print(ans)


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

a = list(map(int,input().split()))
a.sort(reverse=True)

if a[-1] == 0:
	print((0))
	exit()

m = 10 ** 18
ans = 1
for i in range(n):
	ans *= a[i]
	if ans > m:
		print((-1))
		exit()
print(ans)
# Original solution
from operator import mul
from functools import reduce
cnt = 1000000000000000000
N = list(map(int, input().split()))
nums = list(map(int, input().split()))


count  = reduce(mul, nums)
if "0" in N:
        print("0")
elif count  > cnt :
        print((-1))
else:
         print(count)


# Optimized solution
#from operator import mul
#from functools import reduce
#cnt = 1000000000000000000
ans =1
N = int(eval(input()))
nums = list(map(int, input().split()))

if 0 in nums:
        print((0))
        exit()
for num in nums:
    ans *= num
    if ans > 10**18 :
        print((-1))
        exit()
print(ans)
# Original solution
N = int(eval(input()))

A = input().split()
result = 1

for i in A:
    result *= int(i)

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

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

A = input().split()
result = 1

A.sort()
fl = True

if int(A[0]) == 0:
    print((0))
else:
    for i in A:
        result *= int(i)
        if result > 10**18:
            fl = False   
            break                
    if fl:
        print(result)
    else:
        print((-1))
# Original solution
import math
n = int(eval(input()))

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

prod = math.prod(l)
if prod > 10**18:
	print((-1))
else:
	print(prod)

# Optimized solution
import math
n = int(eval(input()))
m = 10**18
l = [int(x) for x in input().split()]
l.sort();
prod = 1
for i in l:
	prod *= i
	if prod > m:
		prod = -1
		break
	elif prod == 0:
		break
print(prod)
# Original solution
eval(input()); n = list(map(int, input().split()))
prod = 1
for i in n:
    prod *= i
print((-1 if prod > 10**18 else prod))

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

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

Con = 10**18

ans = 1
for i in A:
    ans*=i


print((ans if ans<=Con else "-1"))

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

Con = 10**18

ans = 1
if A.__contains__(0):
    print((0))
else:
    for i in A:
        if ans <=Con:
            ans*=i
        else:
            break
    print((ans if ans<=Con else "-1"))
# Original solution
# coding: utf-8
a = int(eval(input()))
b = list(map(int, input().split()))
c = 1
for i in b:
  c = c * i
if c > 10 ** 18:
  print((-1))
else:
  print(c)

# Optimized solution
# coding: utf-8
a = int(eval(input()))
b = list(map(int, input().split()))
c = 1
if 0 in b:
    print((0))
else:
  while c < 10 ** 18 and len(b) != 0:
    c = c * b[0]
    del b[0]
  if c > 10 ** 18:
    print((-1))
  else:
    print(c)
# Original solution
# coding: utf-8
a = int(eval(input()))
b = list(map(int, input().split()))
c = 1
if 0 in b:
    print((0))
else:
  while c < 10 ** 18 and len(b) != 0:
    c = c * b[0]
    del b[0]
  if c > 10 ** 18:
    print((-1))
  else:
    print(c)

# Optimized solution
import sys

num = int(eval(input()))
a = list(map(int, input().split()))
b = 1
if 0 in a:
    print((0))
    sys.exit()
for i in a:
  if b * i > 10 ** 18:
    print((-1))
    sys.exit()
  else:
    b *= i
print(b)
# Original solution
from operator import mul
from functools import reduce
n, *A = list(map(int, open(0).read().split()))
m = reduce(mul, A)
if m > 10**18:
    print((-1))
else:
    print(m)

# Optimized solution
n, *A = list(map(int, open(0).read().split()))
A.sort()
s = 1
for a in A:
    s *= a
    if s > 10**18:
        print((-1))
        break
    elif s == 0:
        print((0))
        break
else:
    print(s)
# Original solution
N = int(input())
A = list(map(int, input().split()))


def ans():
    if 0 in A:
        return print(0)
    product = 1
    for num in A:
        product = product * num
        if product > 10 ** 18:
            return print(-1)

    print(product)


ans()


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

if 0 in A:
    print((0))
    exit()
product = 1
for num in A:
    product = product * num
    if product > 10 ** 18:
        print((-1))
        exit()

print(product)
# Original solution
from functools import reduce
eval(input())
print((a if (a:=reduce(lambda x,y:int(x)*int(y), input().split()))<=1e18 else -1))

# Optimized solution
eval(input())
s=1
for a in map(int,input().split()):
  if a==0:s=0;break
  if s>0:s*=a
  if s>1e18:s=-1
print(s)
# Original solution
L = 1000000000000000000
r = 1
n = eval(input())
for a in map(int, input().split()):
    r *= a
if r > L: print((-1))
else: print(r)

# Optimized solution
L = 1000000000000000000
r = 1
n = eval(input())
A = list(map(int, input().split()))
A = sorted(A)
if A[0] == 0:
    print((0))
else:
    p = True
    while len(A) > 0:
        b = A.pop()
        r *= b
        if r > L:
            print((-1))
            p = False
            break
    if p: print(r)
# Original solution
n = int(eval(input()))
nums = list(map(int, input().split()))
mul = 1
for i in range(n):
    mul *= nums[i]
    
if mul > 10 ** 18:
    print((-1))
else:
    print(mul)

# Optimized solution
def main():
    n = int(eval(input()))
    nums = list(map(int, input().split()))
    
    if 0 in nums:
        print((0))
        return
    
    mul = 1
    for i in nums:
        mul *= i
        if mul > 1000000000000000000:
            print((-1))
            return
        
    print(mul)
    
main()
# Original solution
a = 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

a = eval(input())
l = list(map(int,input().split()))
ans = 1
if 0 in l:
    print((0))
    exit()
for i in l:
    ans *= i
    if ans>10**18:
        print((-1))
        exit()
if ans > 10**18:
    ans=-1
print(ans)
# Original solution
from operator import mul
from functools import reduce
n = int(eval(input()))
a = list(map(int,input().split()))
s = list(a)
p = reduce(mul, s)
if p>10**18:
  print((-1))
else:
  print(p)

# Optimized solution
def solve(N, A):
    ret = 1
    upper = 10**18
    if 0 in A:
      return 0
    for i in A:
        ret *= i
        if upper < ret:
          return -1
    return ret
 
if __name__ == "__main__":
    N = int(eval(input()))
    A = list(map(int, input().split()))
    print((solve(N, A)))
# Original solution
N = int(eval(input()))
ARR = list(map(int, input().split()))


# N = 3
# ARR = [1000000000, 0, 9]
#
# N = 31
# ARR =  [4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0]

import math

def calculate(n, arr):
    res = 1
    for i in range(n):
        if arr[i] == 0:
            res = 0
            break

        if res >0 :
            a1 = math.log(res, 10)
            a2 = math.log(arr[i], 10)
            if a1 + a2 > 18:
                res = -1
                continue

        res = res * arr[i]
        if res > 1000000000000000000:
            res = -1

    return res


print((calculate(N, ARR)))


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


# N = 3
# ARR = [1000000000, 0, 9]
#
# N = 31
# ARR =  [4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0]

def calculate(n, arr):
    res = 1
    for i in range(n):
        if arr[i] == 0:
            res = 0
            break

        if res == -1:
            continue

        res = res * arr[i]
        if res > 1000000000000000000:
            res = -1

    return res


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

thre = 10**18

a.sort()
#print(a)

tmp = a[0]
if(tmp==0):
  print((0))
else:
  for i in range(1,n):
    tmp*= a[i]
  if(tmp > thre):
    print((-1))
  else:
    print(tmp)

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

thre = 10**18

a.sort(reverse=True)
#print(a)

flag = 0
tm = a[n-1]
if(tm==0):
  print((0))
else:
  tmp=a[0]
  for i in range(1,n):
    tmp*= a[i]
    if(tmp > thre):
      flag = 1
      break
  if(flag == 1):
    print((-1))
  else:
    print(tmp)
# Original solution
n = int(eval(input()))
a_li = list(map(int,input().split()))

result = a_li[0]
for i in range(1,n):
  result = result * a_li[i]

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

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

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

a = 1
for x in num_list:
  a = a * x
if a > 1000000000000000000:
  print("-1")
else:
	print(a)

# Optimized solution
n = int(eval(input()))
num_list = list(map(int, input().split()))
     
a = 1
if 0 in num_list:
    print((0))
else:
    for x in num_list:
        a = a * x
        if (a > 1000000000000000000):
            print("-1")
            break
    if (a <= 1000000000000000000):
      print(a)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = 1
for x in a:
    ans *= x

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


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

if 0 in a:
    print((0))
else:
    ans = 1
    for x in a:
        ans *= x
        if ans > 10 ** 18:
            ans = -1
            break

    print(ans)
# Original solution
from functools import reduce
def Qb():
    from functools import reduce
    from operator import mul

    n = int(eval(input()))
    lina = list(map(int, input().split()))

    ans = reduce(mul, lina)

    # for i, a in enumerate(lina):
    #     ans *= a
    if 10 ** 18 < ans:
        ans = -1
    print(ans)


def Qc():
    pass


if __name__ == '__main__':
    Qb()


# Optimized solution
def Qb():
    n = int(eval(input()))
    lina = list(map(int, input().split()))

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

    ans = 1
    for a in lina:
        ans *= a
        if 10 ** 18 < ans:
            ans = -1
            break
    print(ans)

if __name__ == '__main__':
    Qb()
# Original solution
# coding: utf-8
# Your code here!
N = int(eval(input()))
L = list(map(int, input().split()))
ans = 1

for n in range(N):
 ans = L[n]*ans
 if ans >= 1000000000000000001: ans = -1
 if ans >= 1000000000000000001: break

print(ans)

# Optimized solution
# coding: utf-8
# Your code here!
N = int(eval(input()))
L = list(map(int, input().split()))
ans = 1

for n in range(N):
 ans = L[n]*ans
 if ans >= 1000000000000000001: ans = -1
 if ans == -1: break

for n in range(N):
 if L[n] == 0: ans = 0
print(ans)
# Original solution
INF = int(1e18)


def main():
    N, *A, = list(map(int, open(0).read().split()))
    ans = 1
    for a in A:
        ans *= a
    print((-1 if INF < ans else ans))
    return


main()


# Optimized solution
INF = int(1e18)


def main():
    N, *A, = list(map(int, open(0).read().split()))
    ans = 1
    if 0 in A:
        print((0))
        return
    for a in A:
        ans *= a
        if INF < ans:
            print((-1))
            break
    else:
        print(ans)
    return


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

ans = 1
for a in A:
    ans *= 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 a in A:
        ans *= a
        if ans > 10**18:
            ans = -1
            break

print(ans)
# Original solution
from sys import stdin
data = stdin.readlines()

a = int(data[0])
b = [int(s) for s in data[1].split()]

ans = 1
for i in range(0,a):
    ans = ans * b[i]
if ans > 10 ** 18:
    ans = -1

print(ans)

# Optimized solution
from sys import stdin
data = stdin.readlines()

a = int(data[0])
b = [int(s) for s in data[1].split()]

if 0 in b:
    print((0))
else:
    ans = 1
    for i in range(0,a):
        ans = ans * b[i]
        if ans > 10**18:
            print((-1))
            break
        else:
            continue
    else:
        print(ans)
# Original solution
import copy

def main():
    n = int(eval(input()))
    a = list( map( int, input().split()))
    sum = 1
    for i in a:
        k = copy.deepcopy(sum)
        sum = k * i
    if sum - 1000000000000000000 > 0:
        print((-1))
    else:
       print(sum)
    
if __name__ == '__main__':
    main()
   

# Optimized solution
import copy

def main():
    n = int(eval(input()))
    a = list( map( int, input().split()))
    sum = 1
    if 0 in a:
        print((0))
    else:
        for i in a:
            sum = sum * i
            if sum > 1000000000000000000:
                print((-1))
                exit()
        print(sum)
    
if __name__ == '__main__':
    main()
# Original solution
from collections import deque
import sys

def input():
    return sys.stdin.readline().rstrip()

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

ans = 1
for i in li:
    ans *= i

if ans > int(1e18):
    print((-1))
else:
    print(ans)

# Optimized solution
from collections import deque
import sys

def input():
    return sys.stdin.readline().rstrip()

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

ans = 1
for i in li:
    ans *= i
    if (ans > int(1e18)):
        print((-1))
        sys.exit(0)

if ans > int(1e18):
    print((-1))
else:
    print(ans)
# Original solution
n  = int(eval(input()))
arr = list(map(int, input().split(" ")))
z = 10 ** 18
ret = 1
for i in arr:
    ret *= i
if( ret > z):
    ret = -1
    
print(ret)

# Optimized solution
n  = int(eval(input()))
arr = list(map(int, input().split(" ")))
z = 10 ** 18
ret = 1
for i in arr:
    #print(i)
    if(ret != -1):
        ret *= i
    elif ret == -1 and i == 0:
        ret = 0
    if( ret > z):
        ret = -1
    
print(ret)
# Original solution
n=int(eval(input()))
a=list(map(int, input().split()))

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

if tmp>1000000000000000000:
    print((-1))
else:
    print(tmp)



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

ans=1

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

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


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

ans = 1
flag = 0
for x in range(len(i)):
    ans = ans * i[x]
    if ans > 1000000000000000000:
        flag = 1
    if i[x] == 0:
        flag = 2

if flag == 1:
    print((-1))
elif flag == 2:
    print((0))
else:
    print(ans)

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

ans = 1
flag = 0

if i.count(0) > 0:
    print((0))
    flag = 1

if flag == 0:
    for x in range(len(i)):
        ans = ans * i[x]
        if ans > 1000000000000000000:
            flag = 1
            break

    if flag == 1:
        print((-1))
    elif flag == 2:
        print((0))
    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 = -1 if ans >10**18 else ans
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
b = 10**18
A.sort()
for i in range(N):
    ans *=A[i]
    if ans >b:
        print((-1));exit()
    if ans ==0:print((0));exit()
print(ans)
# Original solution
import functools
import operator

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

ans = 1

ans = functools.reduce(operator.mul, N)

#for i in range(len(N)):
#    ans *= N[i]

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

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

ans = 1

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

if ans > 10**18:
    print('-1')
else:
    print(ans)
# Original solution
N = int(input().strip())
array = list(map(int, input().strip().split()))
ans = 1
for i in array:
  ans *= i
if ans > 1e18:
  print((-1))
else :
  print(ans)

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

# Optimized solution
n = int(eval(input()))
ar = list(map(int,input().split()))
ans = 1
z = 0
p = 0
for i in ar:
    if ans != -1:
        ans *= i
    if i == 0:
        z+=1
    if ans > 1e18:
        ans = -1
if z:
    ans = 0
print(ans)
# Original solution
N = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
A = 1
if a[0] == 0:
    A = 0
else: 
    for i in range(N):
        A = A * a[i]
if A > 1000000000000000000:
    print((-1))
else:
    print(A)

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

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

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

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

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

else:
    multi = 1
    for i in a:
        multi *= i
        if multi > 10 ** 18:
            print((-1))
            sys.exit()

    print(multi)
# Original solution
from functools import reduce
n = int(eval(input()))
tab = [int(i) for i in input().split()]

if reduce(lambda x, y: x*y, tab) > pow(10, 18):
  print("-1")
else:
  print((reduce(lambda x, y: x*y, tab)))

# Optimized solution
def main():
	N = int(eval(input()))
	A = list(map(int, input().split()))
	if 0 in A:
		print((0))
		return
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print((-1))
			return
	print(prod)
main()
# Original solution
# import numpy as np
# from decimal import Decimal

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

# A = np.array(A).astype(np.int64)

# ans = int(np.prod(A))


import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

ans = functools.reduce(lambda a, b: a * b, A)

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


# Optimized solution
import sys

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

ans = 1

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

for i in range(N):
  ans *= A[i]
  if ans > 1e18:
    print((-1))
    sys.exit()
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))
else:
    print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
ans = 1
m = 10 ** 18

if 0 in a:
    print((0))
    exit()
for i in a:
    ans *= i
    if ans>m:
        print((-1))
        exit()
    
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
 
res = 1
 
for a in sorted(A):
    res *= a
    if res > 10 ** 18:
        print("-1")
        exit()
print(res)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
for num in sorted(a):
    ans *= num
    if ans > 10**18:
        print("-1")
        exit()
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
for num in sorted(a):
    ans *= num
    if ans > 10**18:
        print("-1")
        exit()
print(ans)

# Optimized solution
def main ():
    N = int(eval(input()))
    A = list(map(int,input(). split ()))
    if 0 in A:
        print((0))
        return
    
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print((-1))
            return
    print(prod)
    
main ()
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = 1

for x in range(n):
    if 0 in a:
        ans = 0
        break

    ans *= a[x]

    if ans > 10**18:
        ans = -1
        break


print(ans)


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

ans = 1

a.sort(reverse=True)

if 0 not in a:
    for x in range(n):
        ans *= a[x]

        if ans > 10**18:
            ans = -1
            break
else:
    ans = 0

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

for i in a:
    if i == 0:
        ans = 0
        break
    ans = ans * i

if ans // (10 ** 18 + 1) != 0:
    ans = -1
print(ans)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans = 1
flg = 0
max = 10 ** 18 + 1

for i in range(n):
    if a[i] == 0:
        ans = 0
        break
    if flg == 0:
        ans = ans * a[i]
    if ans // max > 0:
        ans = -1
        flg = 1

if flg != 0 and ans != 0:
    ans = -1

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

a = list(map(int, input().split()))
m = 1
for i in range(n):
  if a.count(0):
    m = 0
    break
  elif m > 10**18:
    break
  else:
    m *= a[i]
if m == 0:
  print((0))
elif m > 10**18:
  print('-1')
else:
  print(m)

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

# Optimized solution
n = int(eval(input()))
aa = list(map(int, input().split()))
if 0 in aa:
  print((0))
else:
  ans = 1
  for a in aa:
    ans = ans * a
    if ans > 10**18:
      break
  print((-1 if ans > 10**18 else ans))