CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
if 0 in a:
  print((0))
  quit()
ans = 1
for i in a:
    ans *= i
if ans <= 10 ** 18:
    print(ans)
else:
    print((-1))


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

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

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

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

if 0 in a:
    print((0))
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)
# Original solution
from functools import reduce
from operator import mul

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

result = reduce(mul, A)
print((result if result <= 10**18 else -1))

# Optimized solution
"""
from functools import reduce
from operator import mul

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

result = reduce(mul, A)
print(result if result <= 10**18 else -1)
"""
import sys

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

result = 1
for a in A:
    result *= a
    if result > 10**18:
        print((-1))
        sys.exit()
else:
    print(result)
# Original solution
def main():
    n = int(eval(input()))
    As = list(map(int, input().split()))

    ans = 1
    for i in range(n):
        ans *= As[i]
        if ans == 0:
            break

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

    print(ans)


if __name__ == "__main__":
    main()


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

    ans = 1
    if 0 in As:
        print((0))
        exit()

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

    print(ans)


if __name__ == "__main__":
    main()
# Original solution
from functools import reduce
def solve(string):
    from functools import reduce
    from operator import mul
    n, *a = list(map(int, string.split()))
    a = reduce(mul, a)
    return "-1" if a > 10**18 else str(a)


if __name__ == '__main__':
    import sys
    print((solve(sys.stdin.read().strip())))


# Optimized solution
def solve(string):
    n, *a = list(map(int, string.split()))
    a = sorted(a)
    ans = 1
    for _a in a:
        ans *= _a
        if ans > 10**18:
            return "-1"
        if ans == 0:
            return "0"
    return str(ans)


if __name__ == '__main__':
    import sys
    print((solve(sys.stdin.read().strip())))
# Original solution
def solve(string):
    n, *a = list(map(int, string.split()))
    a = sorted(a)
    ans = 1
    for _a in a:
        ans *= _a
        if ans > 10**18:
            return "-1"
        if ans == 0:
            return "0"
    return str(ans)


if __name__ == '__main__':
    import sys
    print((solve(sys.stdin.read().strip())))


# Optimized solution
def solve(string):
    n, *a = list(map(int, string.split()))
    a = sorted(a)
    if a[0] == 0:
        return "0"
    ans = 1
    for _a in a[::-1]:
        ans *= _a
        if ans > 10**18:
            return "-1"
    return str(ans)


if __name__ == '__main__':
    import sys
    print((solve(sys.stdin.read().strip())))
# Original 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 > int(1e18):
			print((-1))
			return

	print(prod)

main()

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

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

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

    print(ans)

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

q = 1000000000000000000
b = 1
cek = True
for i in range(n):
	b = b*a[i]
if b > q :
	print("-1")
else :
	print(b)

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

q = 1000000000000000000
b = 1
cek = True
zero = a.count(0)
if zero > 0 :
	print("0")
else :
	for i in range(n) :
		b = b*a[i]
		if b > q :
			cek = False
			break
	if cek :
		print(b)
	else :
		print("-1")
# Original solution
import sys
input = sys.stdin.readline
from collections import *

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

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

# Optimized solution
import sys
input = sys.stdin.readline

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

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

now = 1

for Ai in A:
    if now*Ai>10**18:
        print((-1))
        exit()
    
    now *= Ai

print(now)
# Original solution
import sys

def main():
    input = sys.stdin.readline
    N = int(eval(input()))
    A = list(map(int , input().split()))
    max_number = 10 ** 18
    result = 1
    if 0 in A:
        print((0))
        return
    for a in A:
        result = result * a
    if result > max_number:
        print((-1))
    else:
        print(result)

    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

def main():
    input = sys.stdin.readline
    N = int(eval(input()))
    A = list(map(int , input().split()))
    max_number = 10 ** 18
    result = 1
    if 0 in A:
        print((0))
        return
    for a in A:
        result = result * a
        if result > max_number:
            print((-1))
            return
    print(result)
    return


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))

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

k = 1

for i in l:
    k = k*i

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

# Optimized solution

n = int(eval(input()))

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

k = 1

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

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

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
result = 1
for i in range(N):
  result *= A[i]
  if result > 10**18:
    result = -1
    break
print(result)
# Original solution
n=int(eval(input()))
a=list(input().split())
ans=1
f=0
i=0
while(i<n):
    if i==n-1:
        ans=ans*int(a[i])
    else:
        ans=ans*int(a[i])*int(a[i+1])
    if f==0 and ans>1000000000000000000:
        f=1
    if ans==0:
        print((0))
        exit()
    i+=2
if f==1:
    print((-1))
    exit()
print(ans)

# Optimized solution
n=int(eval(input()))
a=list(input().split())
ans=1
f=0
i=0
while(i<n):
    if f==0:
        ans=ans*int(a[i])
    if f==0 and ans>1000000000000000000:
        f=1
    if int(a[i])==0:
        print((0))
        exit()
    i+=1
if f==1:
    print((-1))
    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(ans)
else:
    print((-1))

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

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

ans = 1

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

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

c = 0

for i in a_lst:
    if i == 0:
        print((0))
        c = 1
        break
        
    if i > 1000000000000000000:
        print('-1')
        c = 1
        break
        
if c != 1:
    for i, alst in enumerate(a_lst):
        if i == 0:
            b = alst
        else:
            b = b * alst
    
    if b > 1000000000000000000:
        print('-1')
    else:
        print(b)

# Optimized solution
N = int(eval(input()))
A= list(map(int, input().split()))
result=1
if 0 in A:
    result = 0
else:
    for t in range(N):
        result *= A[t]
        if result > 10 ** 18:
            result = -1
            break
print(result)
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
cnt = 1
for ai in a:
  cnt *= ai
if cnt > 10 ** 18:
  print((-1))
else:
  print(cnt)

# Optimized solution
n = int(eval(input()))
a = sorted([int(i) for i in input().split()])
cnt = 1
for ai in a:
  cnt *= ai
  if cnt > 10 ** 18:
    print((-1))
    exit()
print(cnt)
# Original solution
N = int(eval(input()))
li = list(map(int,input().split()))
C = 1
for i in range(N):
  C *= li[i]
if C <= 10 ** 18:
  print(C)
else: print((-1))

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


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

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

x=a[0]

if 0 not in a:
    for i in range (1,n):
        x=x*a[i]
        if x > pow(10,18):
            print((-1))
            exit()           
    print(x)         
else:
    print((0))
# Original solution
n = int(eval(input()))

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

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

if ans >= 1000000000000000001:
    print((-1))
    exit()
print(ans)

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

a = list(map(int, input().split()))
if 0 in a:
    print((0))
    exit()
ans = 1
for i in a:
    ans *= i

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

if 0 in A:
  sum = 0
sum = 1
ans = 0
for x in A:
  sum *= x
  if sum > 1000000000000000000:
    ans = -1
  if sum == 0:
    ans = 0
    break

if ans < 0:
  print(ans)
else:
  print(sum)

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

sum = 1
if 0 in A:
  sum = 0
ans = 0
for x in A:
  sum *= x
  if sum > 1000000000000000000:
    ans = -1
    break
  if sum == 0:
    ans = 0
    break

if ans < 0:
  print(ans)
else:
  print(sum)
# Original solution
a = int(eval(input()))
b = [int(i) for i in input().split()]

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

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

ans =1
b = sorted(b)
for I in b:
  ans = ans*I
  if b[0] == 0:
      ans = 0
      print((0))
      break
  elif ans > 10**18:
    print('-1')
    ans = -1
    break
if ans >=1:
    print(ans)
# Original solution
k=int(eval(input()))
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
            mal=mal*n[i]
            
if(mal<=10**18):
    print(mal)
else:
    print((-1))


# Optimized solution
k=int(eval(input()))
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
    mal=mal*n[i]
    if(mal>10**18):
            mal=-1
            break
for j in range(0,len(n)):
    if(n[j]==0):
        mal=0
print(mal)
# Original solution
from functools import reduce
import sys
import operator
n = int(eval(input()))
l = list(map(int,input().split()))
a = reduce(operator.mul,l)
if a > 10**18:
    print("-1")
    sys.exit()
print(a)

# Optimized solution
import sys
n = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
count = 1
for i in l:
    count= count*i
    if count == 0:
        print("0")
        sys.exit()
    elif count > 10**18:
        print("-1")
        sys.exit()
if count > 10**18:
    print("-1")
    sys.exit()
print(count)
# Original solution
from collections import deque
import math

def Next(): return eval(input())
def NextInt(): return int(Next())
def NextInts(): return list(map(int,input().split()))
def Nexts(): return list(map(str,input().split()))
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [eval(input()) for i in range(n)]

n = int(eval(input()))
da = NextIntList()
da = sorted(da)
ans = 1
for i in range(n):
    ans *= da[i]
    if ans > 10**18:
        ans = -1

if ans < 0:
    print((-1))
else:
    print(ans)


# Optimized solution
from collections import deque
import math

def Next(): return eval(input())
def NextInt(): return int(Next())
def NextInts(): return list(map(int,input().split()))
def Nexts(): return list(map(str,input().split()))
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [eval(input()) for i in range(n)]

n = int(eval(input()))
da = NextIntList()
da = sorted(da)
ans = 1
for i in range(n):
    ans *= da[i]
    if ans > 10**18:
        ans = -1
    elif ans < 0:
        ans = -1

if ans < 0:
    print((-1))
else:
    print(ans)
# Original solution
N = int(eval(input()))

num_list = list(map(int, input().split()))
     
num = 1
     
for i in num_list:
    num *= i
    
    if num == 0:
        break

if num > 1000000000000000000:
    num = -1

print(num)

# Optimized solution
def product(list):
    num = 1

    if any([i == 0 for i in num_list]):
        print((0))
        return
     
    for i in num_list:
        num *= i
        if num > 1000000000000000000:
            num = -1
            break

    print(num)


N = int(eval(input()))

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

product(num_list)
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))
Y = 1
for i in range(0, N):
  Y = X[i] * Y
if Y <= 1000000000000000000:
  print(Y)
else:
  print((-1))

# Optimized solution
import sys

N = int(eval(input()))
X = list(map(int, input().split()))
if min(X) == 0:
  print((0))
  sys.exit()
Y = X[0]
for i in range(1, N):
  Y = X[i] * Y
  if Y > 10 ** 18:
    print((-1))
    sys.exit()
print(Y)
# Original solution
#B
N = int(eval(input()))
A = input().split()
multi= 1
for i in range(N):
    multi *= int(A[i])
if multi > 10**18:
        print((-1))
else:
    print(multi)

# Optimized solution
N = int(eval(input()))
A = input().split()
multi= 1
if('0' in A):
    print((0))
else:
    for i in range(N):
        multi *= int(A[i])
        if multi > 10**18:
            print((-1))
            break
    else:
        print(multi)
# Original solution
num = eval(input())
numlist = input().split()

ans=1
max=10**18
overflg=False
for i in numlist:
  ans *= int(i)

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


# Optimized solution
def keisan(numlist):
  ans=1
  if "0" in numlist:
    return "0"
  for i in numlist:
    ans *= int(i)
    if ans > max:
      return "-1"
  return ans

  
  

num = eval(input())
numlist = input().split()

max=10**18
print((keisan(numlist)))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
p=1
for i in a:
    p*=i
print((p if p<=10**18 else -1))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
p=1
if 0 in a:
    print((0))
    exit()
for i in a:
    p*=i
    if p>10**18:
        print((-1))
        exit()
print(p)
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


if __name__ == '__main__':
    n = int(eval(input()))
    data = list(map(int, input().split()))
    ans = 1
    for d in data:
        ans *= d
    if ans > 10 ** 18:
        print((-1))
    else:
        print(ans)

    #print('\33[32m' + 'end' + '\033[0m') # debug


# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


def solve(data):
    ans = 1
    if 0 in data:
        return 0
    for d in data:
        ans *= d
        if ans > 10 ** 18:
            return -1
    return ans


if __name__ == '__main__':
    n = int(eval(input()))
    data = list(map(int, input().split()))
    ans = solve(data)
    #print('ans') # debug
    print(ans)

    #print('\33[32m' + 'end' + '\033[0m') # debug
# Original solution
import functools
import operator

n=int(eval(input()))

m=list(map(int,input().split()))
result = functools.reduce(operator.mul, m)

if result<=pow(10,18):
  print(result)
else:
  print((-1))

# Optimized solution
import sys

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

ans=1
if 0 in m:
  print((0))
  sys.exit()

for i in range(n):
  ans=ans*m[i]
  if ans>pow(10,18):
    print((-1))
    sys.exit()

if ans<=pow(10,18):
  print(ans)
# Original solution
import sys
import operator
import functools
input = sys.stdin.readline


def main():
    limit = 10**18
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = functools.reduce(operator.mul, A)
    # for i in A:
    #     answer *= i
    #     if answer > limit:
    #         print("-1")
    #         exit()
    print(answer) if answer <= limit else print("-1")


if __name__ == '__main__':
    main()


# Optimized solution
import sys
input = sys.stdin.readline


def main():
    limit = 10**18
    N = int(eval(input()))
    A = list(map(int, input().split()))
    assert N == len(A)
    answer = 1
    if 0 in A:
        print((0))
        exit()
    for i in A:
        answer *= i
        if answer > limit:
            print("-1")
            exit()
    print(answer)


if __name__ == '__main__':
    main()
# Original solution
N=int(eval(input()))
A=[int(x) for x in input().split()]
x=1
P=10**18
for a in A:
  x*=a
if x>P:x=-1
print(x)

# Optimized solution
N=int(eval(input()))
A=[int(x) for x in input().split()]
x=1
P=10**18
if 0 in A:x=0 
else:
  for a in A:
    x*=a
    if x>P:
      x=-1
      break
print(x)
# Original solution
import math
n = int(eval(input()))
a = list(map(int,input().split()))

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

print(ans)

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

ans = 1
a.sort()
for i in range(n):
    ans = ans * a[i]
    if ans == 0:
        ans = 0
        break
    if ans > pow(10,18):
        ans = -1
        break

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

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

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

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

print(x)


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

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

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

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

# Optimized solution
import sys
n=int(eval(input()))
s=input().split()
if '0' in s:
  print((0))
  sys.exit()
l=list(map(int,s))
max=10**18
ans=1
while n>0:
  ans *= l[n-1]
  n-=1
  if ans>max:
    print((-1))
    sys.exit()
print(ans)
# Original solution
N = int(eval(input()))
A = [int(p) for p in input().split()]
Result = 1

for i in A:
    Result = Result*i

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


# Optimized solution
N = int(eval(input()))
A = [int(p) for p in input().split()]
Result = 1

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

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

print(Result)
# Original solution
import functools
import operator
n = int(eval(input()))
l = input().split()
m = []
for i in range(n):
    m.append(int(l[i]))
ans = functools.reduce(operator.mul, m)
if ans <= 10**18:
    print(ans)
else:
    print((-1))


# Optimized solution
n = int(eval(input()))
l = input().split()
ans = 1
T = True
for i in range(n):
    if l[i] == '0':
        ans = 0
        break
if ans != 0:
    for i in range(n):
        if ans <= 10**18:
            ans = ans * int(l[i])
        else:
            T = False
            break
if False:
    print((-1))
elif ans > 10**18:
    print((-1))
else:
    print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
answer = 1

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

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


# Optimized solution
import sys

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

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

for i in range(N):
    answer = answer * A[i]
    if answer > 10**18:
        print((-1))
        sys.exit()
        
print(answer)
# Original solution
from functools import reduce
n=eval(input())
s=list(map(int,(input().split(" "))))
#s.sort()
ans=reduce(lambda x,y:x*y,s)
if ans > 1e18:
    print((-1))
else:
    print(ans)

# Optimized solution
n,*l=list(map(int,open(0).read().split()))
a=1
for i in sorted(l):
  a*=i
  if a>10**18: a=-1; break
print(a)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans *= i

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

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
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
n = int(eval(input()))
a = list(map(int,input().split()))

ans = 1
inf = 10**18 + 1
for i in a:
    ans *= i

ans = min(ans, inf)
if ans == inf:
    ans = -1

print(ans)

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

ans = 1
for a in As:
    ans *= a
    ans = min(ans, 10**18 + 1)

if ans == 10**18 + 1:
    ans = -1
print(ans)
# Original solution
n = int(eval(input()))
a = [int(x) for x in input().split()]
mult = 1
for i in range(n):
    mult *= a[i]
    if mult == 0:
        print((0))
        break
if mult > 1e+18:
    print((-1))
elif mult != 0:
    print(mult)


# Optimized solution
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
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
for i in a:
  ans *= i
if not ans > (10 ** 18):
  print(ans)
else:
  print((-1))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
if a.count(0) > 0:
  ans = 0
else:
  ans = 1

for i in a:
  ans *= i
  if ans > (10 ** 18):
    break

if not ans > (10 ** 18):
  print(ans)
else:
  print((-1))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
mod=10**18

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

if cnt>mod:
    print((-1))
else:
    print(cnt)

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a=sorted(a)
mod=10**18

cnt=1
for i in range(n):
    cnt*=a[i]
    if cnt>mod:
        print((-1))
        exit()

print(cnt)