CodeEff/ECCO huggingface dataset:
# Original solution
# -*- coding: utf-8 -*-
n = int(eval(input()))
a = list(map(int, input().split()))
res = 1 
if 0 in a:
  res = 0
else:
  a.sort(reverse=True)
  for num in a:
    res *= num
    if res > 10**18:
      res = -1
      break
print(res)

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

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

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

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

if 0 in a:
    ans = 0
        
print(ans)
# Original solution
import sys
def main():
    N=int(sys.stdin.readline())
    A=list(map(int,sys.stdin.readline().split()))
    x=1
    for a in A:x*=a
    if x>10**18:x=-1
    print(x)
if __name__=='__main__':main()

# Optimized solution
import sys
def v():
    N=int(sys.stdin.readline())
    A=list(map(int,sys.stdin.readline().split()))
    if A.count(0)>0:return 0
    else:
        A=list([x for x in A if x>1])
        x=1
        for a in A:
            x*=a
            if x>10**18:
                x=-1
                break
        return x
def main():print((v()))
if __name__=='__main__':main()
# Original solution
import sys
input = lambda: sys.stdin.readline().rstrip()

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

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

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

# Optimized solution
import sys
input = lambda: sys.stdin.readline().rstrip()

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

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

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A)
product = 1
if A[0]==0:
  print((0))
else:
  for i in range(len(A)):
    product *= A[i]
    if product > 10**18:
      print((-1))
      break
if product <= 10**18 and A[0]!=0:
  print(product)
# Original solution
A = int(eval(input()))
L = list(map(int,input().split()))

res = 1

for n in L:
    res *= n

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

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

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

res = 1

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

for j in range(len(A)):
  if A[j] == 0:
    flag = 1
    ans = 0

if flag == 0:
  for i in range(N):
    ans = ans * A[i]
    if ans == 0:
      break


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

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

for j in range(len(A)):
  if A[j] == 0:
    flag = 1
    ans = 0

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


if ans > 10 ** 18:
  print('-1')
else:
  print(ans)
# Original solution
import sys
input = sys.stdin.readline


n = int(eval(input()))
up = 10**18
l = list(map(int, input().split()))

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

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


n = int(eval(input()))
up = 10**18
l = list(map(int, input().split()))

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

# Optimized solution
N=int(eval(input()))
lis = list(map(int, input().split()))
ans=1
j=True
if lis.count(0) > 0:
    print((0))
else:
    for a in lis:
        ans*=a
        if ans > pow(10,18):
            j=False
            break
    if j:
        print(ans)
    else:
        print((-1))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print((0))
else:
    for i in range(N):
        a = A[i]
        for j in range(19):
            if a <= 10**j:
                m = j
                break
        for k in range(19):
            if ans <= 10**k:
                n = k
                break
        if(m+n > 19):
            print((-1))
            break
        elif(ans*a == 10**18):
            ans = ans*a
        elif(ans*a > 10**18):
            print((-1))
            break
        else:
            ans = ans*a
        if i == N-1:
            print(ans)

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

# Optimized solution
a,b=open(0);c=1;
for i in sorted(b.split()):
    c*=int(i)
    if c>10**18:print((-1));exit()
print(c)
# Original solution
a,b=open(0);c=1;
for i in sorted(b.split()):
    c*=int(i)
    if c>10**18:print((-1));exit()
print(c)

# Optimized solution
a,b=open(0);c=1;
for i in sorted(b.split()):
    c*=int(i)
    if c>10**18:c=-1;break
print(c)
# Original solution
a,b=open(0);c=1;
for i in b.split():c=[d:=int(i)*c,-1][10**18<d or d*c<0]
print(c)

# Optimized solution
a,b=open(0);c=1;
for i in sorted(b.split()):c=[-1,d:=int(i)*c][-1<d<=10**18]
print(c)
# Original solution
a,b=open(0);c=1;
for i in sorted(b.split()):c=[-1,d:=int(i)*c][-1<d<=10**18]
print(c)

# Optimized solution
a,b=open(0);c=1;
for i in b.split():c=[-1,d:=int(i)*c][-1<d<=10**18]
print(c)
# Original solution
from operator import mul
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))

out = reduce(mul, A)

if out <= 1e18:
  print(out)
else:
  print('-1')

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

A.sort(reverse=True)
out = 1
if A[-1] == 0:
  out = 0
else:
  for i in A:
    out *= i
    if out > 1e18:
      out = -1
      break
print(out)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split(' '))) 

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

if (ans > 1000000000000000000):
    ans = -1

print(ans)


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

A.sort()

ans = 1
for a in A:
    ans *= a
    if ans ==0 or ans > 1000000000000000000:
        break
    
if (ans > 1000000000000000000):
    ans = -1

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:
  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 ans > 10**18:
    print((-1))
    exit()
if ans > 10**18:
  print((-1))
else:
  print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

sum_A = 1
for i in range(0,len(A)):
  if(A[i] == 0):
        print((0))
        exit()
  sum_A *= A[i]
if(sum_A > 1000000000000000000):
        print("-1")
        exit()
print(sum_A)


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

sum_A = 1

for i in range(0,len(A)):
  if(A[i] == 0):
        print((0))
        exit()

for i in range(0,len(A)):
  if(sum_A > 1000000000000000000):
        break
  sum_A *= A[i]
if(sum_A > 1000000000000000000):
        print("-1")
        exit()
print(sum_A)
# Original solution

import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)


N = int(readline())

A = list(map(int,readline().split()))
res = 1
for i in range(N):
    res*=A[i]

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



# Optimized solution

import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)


N = int(readline())

A = list(map(int,readline().split()))

if A.count(0) :
    print((0))
else:
    res = 1
    for i in range(N):
        res*=A[i]
        if res > 10**18:
            print((-1))
            exit()

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

#print(n)
a = list(map(int, input().split()))


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

if ans > 1000000000000000000:
    print((-1))
    exit(0)

print(ans)
exit(0)

### C++と同じく、実行は、Opt + Ctl + N

'''
# -*- coding: utf-8 -*-
# get a integer
a = int(input())
# get two integers separated with half-width break
b, c = map(int, input().split())
# get a string
s = input()
# output
print('{} {}'.format(a+b+c, s))
'''


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

#print(n)
a = list(map(int, input().split()))

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


ans = 1
for i in range(n):
    ans *= a[i]
    #if a[i]==0:
    #    print(0)
    #    exit(0)

    if ans > 1000000000000000000:
        print((-1))
        exit(0)

print(ans)
exit(0)

### C++と同じく、実行は、Opt + Ctl + N

'''
# -*- coding: utf-8 -*-
# get a integer
a = int(input())
# get two integers separated with half-width break
b, c = map(int, input().split())
# get a string
s = input()
# output
print('{} {}'.format(a+b+c, s))
'''
# Original solution
N = int(eval(input()))
AN = list(map(int, input().split()))

X = 1
for i in range(N):
    X = X*AN[i]
if X <= 10**18:
    print(X)
else:
    print((-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 *= A[i]
    if ans > 10 ** 18:
        print((-1))
        exit()
print(ans)
# Original solution
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)
n = int(eval(input()))
a = list(map(int, input().split()))
ans = prod(a)

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


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

ans = 1

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


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

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

ans = 1

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

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


if ans > 10 ** 18:
    print((-1))
    exit()
print(ans)
# Original solution
n = int(eval(input()))
a = input().split()

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

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

def main():

    test = int(eval(input()))
    inp = input().split(' ')

    p=1;
    for x in inp:
        p = p*int(x)
    
    if(p>10**18):
        print((-1));
    else:
        print(p);

        
        

if __name__ == '__main__':
    main()

# Optimized solution
import math

def main():

    test = int(eval(input()))
    inp = input().split(' ')
    inp = sorted(inp)
    p=1;
    for x in inp:
        p = p*int(x)
        if p> 10**18 or p==0:
            break;
    
    if(p>10**18):
        print((-1));
    else:
        print(p);

        
        

if __name__ == '__main__':
    main()
# Original solution
def main():
	flag = True
	N = int(eval(input()))
	arr = list(map(int, input().split()))
	ans = arr[0]
	for i in range(1, N):
		ans *= arr[i]
	if ans > 1000000000000000000:
		print((-1))
	else:
		print(ans)


if __name__ == '__main__':
	main()

# Optimized solution
def main():
	N = int(eval(input()))
	arr = list(map(int, input().split()))
	ans = arr[0]
	if arr.count(0) > 0:
		print((0))
		return
	for i in range(1, N):
		ans *= arr[i]
		if ans > 1000000000000000000:
			print((-1))
			return
	print(ans)


if __name__ == '__main__':
	main()
# Original solution
import sys
N = int(eval(input()))
num_list = list(map(int, input().split()))
c = 1
for i in range(N):
        c = c * num_list[i]

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

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

if 0 in A:
  ans = 0
  N = 0

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

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


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
 
def solve():
    if 0 in A:
        return 0
    m = 1
    for a in A:
        m *= a
        if m > 10**18:
            return -1
    return m
 
print((solve()))
# Original solution
import math

fuga = int(eval(input()))
arr = list(map(int, input().split()))

hoge =1
for num in arr:
    hoge = hoge*num

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


# Optimized solution
import math

kosuu = int(eval(input()))
arr = list(map(int, input().split()))

hoge =1

if 0 in arr:
    print((0))

else:
    for num in arr:
        hoge = hoge*num
        if hoge>1000000000000000000:
            print((-1))
            kosuu=0
            break
    if kosuu>0:
        print(hoge)
# Original solution
import sys
N=int(eval(input()))
s = list(map(int, input().split()))
ans =1
for i in s:
    ans*=i
    
if ans>1e18:
    print((-1))
    sys.exit(0)

print(ans)


# Optimized solution
import sys
N=int(eval(input()))
s = list(map(int, input().split()))
ans =1
for i in s:
    if i==0:
        print((0))
        sys.exit()
    
for i in s:
    ans*=i
    if ans>1e18:
        print((-1))
        sys.exit()

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

# Optimized solution
N=int(eval(input()))
K=list(map(int,input().split()))
L=sorted(K)
maxi=1
for i in range(18):
  maxi=maxi*10
pro=1
for i in range(N):
  pro=pro*L[i]
  if maxi<pro:
    print((-1))
    break
if maxi>=pro:
  print(pro)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
if 0 in a:
    print((0))
    exit(0)
p = 1
for i in range(n):
    p *= a[i]
if p>10**18:
    p = -1
print (p)


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

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

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

def main():
  if 0 in A:
    print((0))
    return
 
  count = 1
  for i in A:
    count *= i
    if count > 1000000000000000000:
      print((-1))
      return
 
  print(count)

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

def main():
  if 0 in A:
    print((0))
    return
 
  count = 1
  for i in A:
    count *= i
    if count > 1000000000000000000:
      print((-1))
      return
 
  print(count)

main()


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

def main():
  if 0 in A:
    print((0))
    return
 
  count = 1
  for i in A:
    count *= i
    if count > 1e18:
      print((-1))
      return
 
  print(count)

main()
# Original solution
n = int(eval(input()));
l=list(map(int,input().strip().split()))
l.sort()
if l[0] == 0 : 
    print("0")
else :    
    ans = l[0]
    c=0
    for i in range(1, n, 1) :
        if l[i]*ans >  1000000000000000000 :
            print("-1")
            c=1
        ans = ans*l[i]    
    if c == 0 : 
        print(ans)        
    
  

# Optimized solution
n = int(eval(input()));
l=list(map(int,input().strip().split()))
l.sort()
if l[0] == 0 : 
    print("0")
else :    
    ans = l[0]
    c=0
    for i in range(1, n) :
        if l[i]*ans >  int(1000000000000000000) :
            print("-1")
            c=1
        if c == 1 : 
            break 
        ans = ans*l[i]    
    if c == 0 : 
        print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
from operator import mul
from functools import reduce
 
ans = reduce(mul, A) #結果=>120
 
if ans > 10**18 :
  print((-1))
else:
  print(ans)

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

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

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

a = int(eval(input()))
l = list(map(int, input().split()))
ans = reduce(mul, l) 
if 10**18 < ans:
  print((-1))
else:
  print(ans)

# Optimized solution
a = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 1
for i in range(a):
  ans = ans * l[i]
  if 10**18 < ans:
    ans = -1
    break

print(ans)
# Original solution
from functools import reduce
import operator
n = int(eval(input()))
a = list(map(int, input().split()))
ans = reduce(operator.mul, a, 1)
if ans <= 10**18:
    print(ans)
else:
    print((str(-1)))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1;
for i in range(n):
    if ans > 10**18:
        break
    ans *= a[i]
if 0 in a:
    print((0))
elif ans <= 10**18:
    print(ans)
else:
    print((-1))
# Original solution
from functools import reduce
from operator import mul
n = int(eval(input()))
arr = list(map(int, input().split()))

ans = reduce(mul, arr)
print((-1 if ans > 10**18 else ans))

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

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

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

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

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

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0

if(can==1):
    print(ans)
else:
    print((-1))


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

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0
            break

if(can==1):
    print(ans)
else:
    print((-1))
# Original solution
n = int(eval(input()))
array = list(map(int, input().split()))

ans = 1
for i in range (n):
    if array[i] == 0:
        ans = 0

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

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


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

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

print(ans)
# Original solution
N=int(eval(input()))
A = [int(x) for x in input().split()]

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

                


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

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

n = 1

for i in a:
    n *= i

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


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

ans = 1

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

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

else:
    print(ans)
# Original 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 = ans*i
if ans > 10**18:
  print((-1))
  exit()
print(ans)

# Optimized solution
n=int(eval(input()))
arr=list(map(int,input().split()))
arr=sorted(arr) 
ans=1
for val in arr:
 ans*=val 
 if ans>10**18:
   print((-1))
   break
else:
 print(ans)
# Original solution
N = int(eval(input())) - 1
A = list(map(int, input().split()))

ans = int(A[N])

while N > 0:
    ans = ans * A[N-1]
    N = N-1

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

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

ans = int(A[N])

if 0 in A:
    ans = 0
else:
    while N > 0:
        ans = ans * A[N-1]
        N = N-1
        if ans > 10 ** 18:
            N = 0
        else:
            N = N

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
a = 1
for i in range(N):
    a *= A[i]
    if a>10**18:
        print((-1))
        exit()
print(a)
# Original solution
# import numpy as np

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

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



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

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

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

p = 1
for i in a:
    p *= i
    # print(p)
    if p > 10**18:
        print((-1))
        exit()
print(p)
# Original solution
N = int(eval(input())) #1行目のNを取得する
i = list(map(int, input().split()))

result = 1

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

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



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

result = 1
flag = 0
zero_flag = False
for x in range(N):
  if(i[x]==0):
    zero_flag = True
    result = 0

if(zero_flag==False):
  for x in range(N):
    result *= i[x]
    if(result>pow(10,18)):
      flag = 1
      break

if(flag==1):
  print('-1')
else:
  print(result)