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

if(N%2==0):
    for i in range(int(N/2)):
        ans *= (A[i]*A[N-1-i])
else:
    for i in range(int(N/2)):
        ans *= A[i]*A[N-1-i]
    ans*=A[int((N-1)/2)]

if(ans>1000000000000000000):
    print("-1")
else:
    print(ans)
    




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

for i in range(N):
    if(A[i]==0):
        flag=1

if flag==0:        
    if(N%2==0):
        for i in range(int(N/2)):
            ans *= (A[i]*A[N-1-i])
            if(ans>1000000000000000000):
              break
    else:
        for i in range(int(N/2)):
            ans *= A[i]*A[N-1-i]
            if(ans>1000000000000000000):
                break
        ans*=A[int((N-1)/2)]

if flag==1:
    print((0))
elif(ans>1000000000000000000):
    print((-1))
else:
    print(ans)
# Original solution
def solve():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    if 0 in A:
        return 0
    prod = 1
    for i in range(N):
        if 10**18//prod < A[i]:
            return -1
        prod *= A[i]
    return prod
print((solve()))

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

    ans = 1
    if 0 in a: return 0
    for i in a:
        ans *= i
        if ans > int(1e18): return -1
    
    
    return ans
    

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

# Optimized solution
n = int(eval(input()))
A = list(map(int,input().split()))
total = 1
count = 0
for i in range(n):
    total *= A[i]
    if total > 10**18:
        count += 1
        break

if 0 in A:
    print('0')
elif count == 1:
    print('-1')
else:
    print(total)
# Original solution

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

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

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


# Optimized solution

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

ans = 1
for i in l:
    ans *= i
    if ans > 10**18:
        print((-1))
        break
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 > 1000000000000000000: print((-1))
else:print(ans)

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

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

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

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

print(ans)


# Optimized solution
# coding: utf-8

N = int(eval(input()))
A = sorted(list(map(int,input().split())))
if A[0] == 0:
    ans = 0
else:
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans > 10**18:
            ans = -1
            break

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

print((str(ans)))


# Optimized solution
n = int(eval(input()))
An = list(map(int, input().split()))
An.sort(reverse=True)
ans = An[0]
for i in range(1,n):
  if An[i] == 0:
    ans = 0
    break
  if An[i] > (10 ** 18):
    ans = -1
    break;
if ans > 0:
  ans = An[0]
  for i in range(1,n):
    if An[i] > (10 ** 18):
      ans = -1
      break
    ans *= An[i]
    if ans > (10 ** 18):
      ans = -1
      break

print((str(ans)))
# Original solution
N=int(eval(input()))
A=list( map(int,input().split()))
B=int(1)
for i in A:
  B*=i
if(B>10**18):
  B=-1
print(B)

# Optimized solution
N=int(eval(input()))
A=list( map(int,input().split()))
A.sort()
B=int(1)
for i in A:
  B*=i
  if(B>10**18):
    B=-1
    break
print(B)
# Original solution
N = int(eval(input()))

a = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans = 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:
    ans = 0
else :
    for i in range(N):
        ans = ans * a[i]
        if ans > 10**18:
            ans = -1
            break
print(ans)
# Original solution
n = int(eval(input()))
big = 0
a = list(map(int, input().split()))
ans = 1
for num in a:
    ans = ans * num
if ans > 10 ** 18:
    print((-1))
else:
    print(ans)

# Optimized solution
n = int(eval(input()))
big = 0
a = list(map(int, input().split()))
a.sort()
ans = 1
for num in a:
    if num == 0:
        print((0))
        big = 1
        break
    ans = ans * num
    if ans > 10 ** 18:
        print((-1))
        big = 1
        break
if big == 0:
    print(ans)
# Original solution
N=int(eval(input()))
a=list(map(int,input().split()))
p=1
for i in range(N):
  p=p*a[i]
  
if p>10**18:
  print((-1))
else:
  print(p)

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

for i in range(N):
  if a[i]==0:
    print((0))
    sys.exit()
    
p=1
for i in range(N):
  p=p*a[i]
  if p>10**18:
    print((-1))
    sys.exit()

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

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

ans = reduce(mul,List)
print((ans if ans<=10**18 else -1))

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

List.sort()
ans = 1
for i in List:
    ans *= i
    if ans > 10**18:
        print((-1))
        break
else:
    print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
from itertools import accumulate
import operator
cumprod = list(accumulate(a, operator.mul))[-1]

print((-1 if cumprod > 10**18 else cumprod))

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

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

cumprod=1
for i in range(n):
    cumprod *= a[i]
    if cumprod > 10**18:
        print((-1))
        exit()
print(cumprod)
# Original solution
n=int(eval(input()))
a=[int(i) for i in input().split()]
b=1

for i in a:
    b=b*i

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


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

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

product = 1

for i in range(N):
    product *= A[i]

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


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

product = 1
flag = 0

if 0 in A:
    print((0))
else:
    for i in range(N):
        product *= A[i]
        if product > 1000000000000000000:
            flag += 1
            break
    if flag == 0:
        print(product)
    else:
        print((-1))
# Original solution
N = int(eval(input()))
numbers =[i for i in map(int,input().split())]
result =1
standard = 10**18
for i in range(N):
  result *= numbers[i]
  if result == 0:
    print("0")
    break
else:
  if result > standard:
    print("-1")
  else:
  	print(result)

# Optimized solution
n = int(eval(input()))
a = [i for i in map(int, input().split())]
 
if a.count(0) != 0:
  print((0))
else:
  result = 1
  for i in range(n):
    result *= a[i]
    if result > (10**18):
      print((-1))
      break
    else:
      continue
  else:
    print(result)
# Original solution
n = int(eval(input()))
a = [int(x) for x in input().split()]

from operator import mul
from functools import reduce

ans = reduce(mul,a)
if ans <= pow(10,18):
    print(ans)
else:
    print((-1))

# Optimized solution
n = int(eval(input()))
a = [int(x) for x in input().split()]
if 0 in a:
    print((0))
else:

    ans = 1
    for i in a:
        ans *= i
        if ans > pow(10,18):
            ans = -1
            break
    print(ans)
# Original solution
N = int(eval(input()))
ans = 1
for i in map(int,input().split()):
    ans = ans * i
if ans > 10**18:
    print('-1')
else:
    print(ans)

# Optimized solution
N = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')
# 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
if a.count(0) > 0:
    print((0))
    exit()
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print((-1))
        exit()
print(ans)
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
ans = 1
for aa in a:
    ans *= aa
if ans > 10 ** 18:
    print((-1))
else:
    print(ans)


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
a.sort()
ans = 1
for aa in a:
    ans *= aa
    if ans > 10 ** 18:
        print((-1))
        exit()
print(ans)
# Original solution
N=int(eval(input()))

A=1
for a in [int(x) for x in input().split()]:
  A*=a
print((A if A<=10**18 else -1))


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

A=sorted([int(x) for x in input().split()],reverse=True)
if A[-1]==0:
  print((0))
else:
  m=1
  for a in A:
    m*=a
    if m>10**18:
      break
  print((m if m<=10**18 else -1))
# Original solution
n = int(eval(input()))
ls = [int(x) for x in input().split()]
if 0 in ls:
    print((0))
    exit()
res = 1
for x in ls:
    res *= x
print((res if res <= 1000000000000000000 else -1))

# Optimized solution
n = int(eval(input()))
ls = [int(x) for x in input().split()]
if 0 in ls:
    print((0))
    exit()
res = 1
for x in ls:
    if res <= 1000000000000000000:
        res *= x
    else:
        break

print((res if res <= 1000000000000000000 else -1))
# Original solution
n = int(eval(input()))
l = list(map(int, input().split()))

ans = 1
for i in l:
  ans *= i
  
if ans > 1000000000000000000:
  print((-1))
else:
  print(ans)

# Optimized solution
import sys

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

ans = 1

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

for i in l:
  ans *= i
  if ans > 1000000000000000000:
    print((-1))
    sys.exit()
print(ans)
# Original solution
n = int(eval(input()))
arr = list(map(int, input().split()))
acc = arr[0]
for e in arr[1:]:
  acc *= e
if acc > 1e18:
  print((-1))
else:
  print(acc)

# Optimized solution
n = int(eval(input()))
arr = list(map(int, input().split()))
if 0 in arr:
    print((0))
    exit()

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

# Optimized solution
n=int(eval(input()))
nl=list(map(int,input().split()))
nl.sort()
ans=1
for s in range(n):
  ans=ans*nl[s]
  if ans>10**18:
    ans=-1
    break
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
res = 1
for a in A:
  res *= a
if res > 1e18:
  print((-1))
else:
  print(res)

# Optimized solution
import sys
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print((-1))
    sys.exit()
print(res)
# Original solution

def main():
    n = int(eval(input()))
    a = list(map(int,input().split()))
    temp = 1
    for n in a:
        temp *= n
    if temp > (10 ** 18):
        temp = -1
    print(temp)

if __name__ == '__main__':
    main()


# Optimized solution

def main():
    n = int(eval(input()))
    a = list(map(int,input().split()))
    temp = 1
    if 0 in a:
        temp = 0

    for n in a:
        if temp == -1:
            break
        temp *= n
        if temp > 10 ** 18:
            temp = -1
            break
    print(temp)

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

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

# Optimized solution
N = eval(input())
A = input().split()
if '0' in A:
    print((0))
else:
    N = int(N)
    sum = 1
    for i in range(N):
        sum *= int(A[i])
        if sum > 10**18:
            print((-1))
            exit()
    print(sum)
# Original solution
n = int(eval(input()))
# h1, m1, h2, m2, k = list(map(int, input().split()))
#a, b = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# k = int(input())
#p = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
# py = [list(map(int, input().split())) for i in range(m)]
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
    # print(ans)
    if ans > 1000000000000000000 and not(0 in a):
        print((-1))
        exit()
print(ans)


# Optimized solution
n = int(eval(input()))
# h1, m1, h2, m2, k = list(map(int, input().split()))
#a, b = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# k = int(input())
#p = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
# py = [list(map(int, input().split())) for i in range(m)]
a = list(map(int, input().split()))
ans = 1
if 0 in a:
    print((0))
else:
    for i in range(n):
        ans *= a[i]
        # print(ans)
        if ans > 1000000000000000000:
            print((-1))
            exit()
    print(ans)
# 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
def main():
  N=int(eval(input()))
  A=list(map(int,input().split()))
  A.sort(reverse=True)
  ans=1
  if A[-1]!=0:
    for a in A:
      ans*=a
      if ans > 10**18:
        ans=-1
        break
  else:ans=0
  print(ans)
if __name__ == '__main__':
  main()
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

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

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


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

x = 1
for i in a:
    x *= i
    if x > 10**18:
        break

ans = x
if ans > 10**18:
    ans = -1
print(ans)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
sorted(A)
result=1
for i in A:
    if 0 in A:
        result=0
        break
    result*=i
    if result>1000000000000000000:
        result=-1
        break
print(result)


# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
sorted(A)
result=1
if 0 in A:
    result=0
for i in A:
    if result==0:
        break
    result*=i
    if result>1000000000000000000:
        result=-1
        break

print(result)
# Original solution
from functools import reduce

n = int(eval(input()))
a = [int(arg) for arg in input().split()]
res = reduce(lambda x, y: x*y, a)
print((res if res <= 10**18 else -1))


# Optimized solution
n = int(eval(input()))
a = [int(arg) for arg in input().split()]
res = 1
if 0 in a:
    print((0))
    exit()

for i in a:
    res *= i
    if res > 10**18:
        res = -1
        break
print(res)
# Original solution
totalNumbers=int(eval(input()))
array=list(map(int,input().split()))
import math
answer=math.prod(array)
print((-1 if answer>10**18 else answer))


# Optimized solution
totalNumbers = int(eval(input()))
array = list(map(int, input().split()))
answer = 1
if 0 in array:
    print((0))
else:
    for number in array:
        answer*=number
        if answer>10**18:
            answer=-1
            break
    print(answer)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

tmp = 1
import sys

for i in range(N):
    tmp *= A[i]
if tmp > 10**18:
    print((-1))
else:
    print(tmp)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
import sys
tmp = 1
A.sort(reverse = True)
if 0 in A:
    print((0))
else:
    for i in range(N):
        tmp *= A[i]
        if tmp > 10**18:
            print((-1))
            sys.exit()
    print(tmp)
# Original solution
n = int( eval(input()) )
a = list( map( int, input().split() ) )
 
ret = 1
if 0 in a:
  ret = 0
else:
  for ai in a:
    ret = ret * ai
    if ret > 10 ** 18:
      ret = -1
 
print( ret)

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

if 0 in A:
  print(( 0 ))
else:
  ret = 1
  for a in A:
    ret = ret * a
    if ret > 10 ** 18:
      ret = -1
      break
  print( ret )
# Original solution
n = int(eval(input()))
out = 1
an = list(map(int,input().split()))

for a in an:
  out *= a
if out>10**18:
  out=-1
print(out)

# Optimized solution
n = int(eval(input()))
out = 1
an = list(map(int,input().split()))
check = True
if 0 in an:
  print((0))
else:
  for a in an:
    out *= a
    if out>1000000000000000000:
      check = False
      break
  if check:
      print(out)
  else:
      print((-1))
# Original solution
n=int(eval(input()))
num=list(map(int,input().split()))

sum=1
for i in range(n):
    sum*=num[i]
    if sum==0:
        print((0))
        break
else:
    if sum>10**18:
        print((-1))
    else:
        print(sum)

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

sum=1
if 0 in num:
    print((0))
else:
    for i in range(n):
        sum*=num[i]
        if sum>10**18:
            print((-1))
            break
    else:
        print(sum)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
for i in range(N):
    ans = 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:
    ans = 0
else:
    for i in range(N):
        ans = ans * A[i]
        if ans > 10**18:
            ans = -1
            break

    
print(ans)
# Original solution
from functools import reduce
n = int(eval(input()))
a = [int(x) for x in input().split()]

x = reduce(lambda x, y: x*y, a)

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

# Optimized solution
n = int(eval(input()))
a = [int(x) for x in input().split()]


ans = 1
a.sort()

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

print(ans)
# Original solution
n = int(eval(input()))
apple = list(map(int, input().split()))
cat = 1
for i in apple:
    cat *= i
print((cat if cat <= 10**18 else -1))

# Optimized solution
n = int(eval(input()))
apple = list(map(int, input().split()))
if 0 in apple:
    print((0))
else:
    cat = 1
    for i in apple:
        cat *= i
        if cat > 10**18:
            break
        else:
            pass
    print((cat if cat <= 10**18 else -1))
# Original solution
if __name__=="__main__":
    # Problem B
    N = int(eval(input()))
    A = [None]*N
    A = list(map(int, input().split(' ')))
    result = 1
    flag = False
    for x in A:
        result = result * x

    if result > 1e18:
        print("-1")
    else:
        print(result)


# Optimized solution
if __name__=="__main__":
    # Problem B
    N = int(eval(input()))
    A = [None]*N
    A = list(map(int, input().split(' ')))
    result = 1
    flag = False
    is_zero = False
    if 0 in A:
        print("0")
    else:
        for x in A:
            result = result * x
            if result > 1e18:
                flag = True
                break
        if flag:
            print("-1")
        else:
            print(result)
# Original solution
N = int(eval(input()))
l = list(map(int, input().split()))

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


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

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

# Optimized solution
n = int(eval(input()))
a_list = list(map(int,input().split()))
result = 1
if 0 in a_list:
  print((0))
else:
  for a in a_list:
    result = result *a
    if len(str(result)) >= 19:
      if result == 10**18:
        continue
      else:
        result = -1
        break
        
  print(result)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

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

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

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

A = sorted(A)
ans = 1
for a in A:
    ans *= a
    if a == 0:
        ans = 0
        break
    if ans > 10**18:
        ans = -1
        break

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

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
U = 10 ** 18
p = 1
for x in A:
    p *= x
    if p > U:
        p = U + 1
 
if p > U:
    print((-1))
else:
    print(p)
# Original solution
n = int(eval(input()))
ans = 1
A = tuple(map(int,input().split()))
from collections import defaultdict
d = defaultdict(int)
for a in A:
    d[a] += 1
for k in d:
    ans *= k**d[k]
if ans > 10**18:
    print((-1))
else:
    print(ans)

# Optimized solution
n = int(eval(input()))
ans = 1
A = list(map(int,input().split()))
A.sort()
if A[0] == 0:
    print((0))
    exit()
elif A[-1]*A[-2] > 10**18:
    print((-1))
    exit()
from collections import defaultdict
d = defaultdict(int)
for a in A:
    d[a] += 1
for k in d:
    ans *= k**d[k]
if ans > 10**18:
    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)