CodeEff/ECCO huggingface dataset:
# Original solution

#!/usr/bin/python
# -*- 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:
    print(ans)
else:
    print((-1))


# Optimized solution

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

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

if A.count(0) > 0:
    print((0))
    exit()

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

if ans <= 10**18:
    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 > pow(10, 18):
    ans = -1

print(ans)

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

ans = 1
lim = pow(10, 18)
for a in A:
    ans *= a
    if ans > lim:
        ans = -1
        break

print(ans)
# Original solution
N = int(eval(input()))
An = list(map(int,input().split()))
a = 1
if 0 in An:
    print("0")

else:
    for i in range(N):
        a *= An[i]
    if a <= 10**18:
        print(a)
    else:
        print("-1")

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

ret = 1
for ai in a:
    ret *= ai

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

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

# import numpy as np
# ret = np.prod(a)

if a.count(0) > 0:
    print((0))
else:
    ret = 1
    for ai in a:
        ret *= ai
        if ret > 10**18:
            print((-1))
            break
    else:
        if ret > 10**18:
            print((-1))
        else:
            print(ret)

    # if ret > 10**18 or ret < 0:
    #     print(-1)
    # else:
    #     print(ret)
# Original solution
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n=int(eval(input()))

l=list(map(int,input().split()))
a=1
for i in range(0,n):
	a=a*l[i]


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


if a<10**18+1:
	print(a)	 

# Optimized solution
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
   
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n=int(eval(input()))

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

a=1
if l[0]==0:
	print("0")

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

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
if 0 in a:
    ans = 0
else:
    ans = 1
    for i in a:
        if ans * i > 10**18:
            ans = -1
            break
        else:
            ans = ans * i
print(ans)
# Original solution
# 制約条件
MAX_RESULT = 1000000000000000000

N = int(eval(input()))
A1 = [int(x) for x in input().split()]

tmp = 1

for x in range(len(A1)):
    tmp = tmp * A1[x]

result = tmp

if (result > MAX_RESULT):
    result = -1

print(result)

# Optimized solution
def main():
    # 制約条件
    MAX_RESULT = 1000000000000000000
    
    N = int(eval(input()))
    A = [int(x) for x in input().split()]
    
    if 0 in A:
        result = 0
        print(result)
        return
    
    result = 1
    
    for x in A:
        result *= x
        if result > MAX_RESULT:
            print((-1))
            return
    print(result)
main()
# Original solution
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(eval(input()))
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    ams=1
    for x in a:
        ams*=x

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

    print(ams)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

# Optimized solution
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    n=int(eval(input()))
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    a=list(map(int,sys.stdin.readline().split(' ')))
    ams=1

    if 0 in a:
        print((0))
        continue
        
    for x in a:
        ams*=x
        if ams> 1000000000000000000:
            ams=-1
            break

    print(ams)
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()
# Original solution
N = int(eval(input()))
S = [int(s) for s in input().split()]
l = 1
for s in S:
  l = l * s
if l > 10**18:
  l = -1
print(l)

# Optimized solution
N = int(eval(input()))
S = [int(s) for s in input().split()]
if 0 in S:
  l = 0
else:
  l = 1
  for s in S:
    l = l * s
    if l > 10**18:
      l = -1
      break
print(l)
# Original solution
import sys
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    n = int(stdin.readline().rstrip())
    #A, B = map(float, stdin.readline().rstrip().split())
    A = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    import functools
    import operator
    result = functools.reduce(operator.mul, A)
    if result > 10**18:
        print((-1))
    else:
        print(result)


main()


# Optimized solution
import sys

stdin = sys.stdin

def main():
    n = int(stdin.readline().rstrip())
    A = list(map(int, stdin.readline().rstrip().split()))
    A.sort()
    ans = 1
    for i in range(n):
        if ans > 10**18:
            if A[0] == 0:
                print((0))
                exit()
            print((-1))
            exit()
        ans *= A[-i]
    print((ans if ans <= 10**18 else -1))


main()
# Original solution
n=int(eval(input()))
a=input().split()
ans=1

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

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

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

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


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

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

if(ans>x):
  ans=-1
print(ans)

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

N, = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = 1
for x in A:
    ans *= x
if ans > 10 ** 18:
    print((-1))
else:
    print(ans)


# Optimized solution
N, = [int(x) for x in input().split()]
A = [int(x) for x in 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
N = int(eval(input()))
A = list(map(int,input().split()))
PI = 1
for i in range(N):
    PI = PI*A[i]
if PI > 10**(18):
    print((-1))
else:
    print(PI)

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

b=input().split()

if "0" in b:
    print((0))
else:

    count=1
    for i in b:
        count=count*int(i)
        
    if count>10**18:
        print((-1))
    else:
        print (count)


# Optimized solution
wfwfe=eval(input())
check=0
b=input().split()
if "0" in b:
    print((0))
else:
    
    count=1
    for i in b:
        count=count*int(i)
        
        if count>10**18:
            print((-1))
            check=1
            break
    if check==0:
        print (count)
# Original solution


n=int(eval(input()))
l=list(map(int,input().split()))
res=1
f=1
for x in l:
    res=res*x
    if(res>1000000000000000000):
        
        f=0
    else:
        f=1
if(f==1):
    print(res)
else:
    print((-1))
    
        
    
    


# Optimized solution


n=int(eval(input()))
l=list(map(int,input().split()))
res=1
f=1
if(0 in l):
    print((0))
    f=0
if(f==1):
    
    for x in l:
        res=res*x
        if(res>1000000000000000000):
            print((-1))    
            f=0
            break
    
    if(f==1):
        print(res)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))

import math

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

b = int(math.pow(10,18))

if total-b>0:
    print((-1))
else:
    print(total)



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

if a.count(0)>0:
    print((0))
    exit(0)

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

    if total>10**18:
        print((-1))
        exit(0)
    
print(total)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

limit = 10 ** 18
current = 1

maxFlag = False

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

if current > limit:
    print((-1))
else:
    print(current)


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

rev_A = sorted(A, reverse=True)

if 0 in rev_A:
    print((0))
    exit()
else:
    limit = 10 ** 18
    current = 1

    for x in range(N):
        current *= rev_A[x]

        if current > limit:
            print((-1))
            exit()
    print(current)
# Original solution
#!/usr/bin/env python3
import math
import sys

input = sys.stdin.readline
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(ans)

# Optimized 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
        break 
if 0 in A:
  print((0))
else:
  print(ans)
# Original solution
#!/usr/bin/env python3

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

# Optimized solution
#!/usr/bin/env python3

N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print((0))
    exit()
else:
    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
for i in a:
    ans *= i

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


# Optimized solution
import sys
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
flag = True
if 0 in a:
    print((0))
    sys.exit()

for i in a:
    ans *= i
    if ans > 1000000000000000000:
        flag = False
        break

if flag == False:
    print((-1))
else:
    print(ans)
# Original solution
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(eval(input()))
    A = list(map(int, input().split()))

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

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


if __name__ == '__main__':
    resolve()


# Optimized solution
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(eval(input()))
    A = sorted(list(map(int, input().split())))

    res = 1
    for a in A:
        res *= a
        if res > 10 ** 18:
            print((-1))
            break
    else:
        print(res)


if __name__ == '__main__':
    resolve()
# Original solution
#A
n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
b = 0
for i in a:
    ans *= i
    if ans > 10 ** 18:
        b = -1
if ans == 0:#例外ans=0のときは途中で10^18を超えても0となる
    b = 0
if b == -1:#10^18を超えてる
    print((-1))
else:
    print(ans)


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

# Optimized solution
n=int(eval(input()))
s=1
f=0
x=[int(x) for x in input().split()]
if x.count(0)>0:
    print((0))
else:
    for i in range(len(x)):
        s=s*x[i]
        if s>10**18:
            f=1
            break
    if f:
        print((-1))
    else:print(s)
# 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))
    exit()
print(ans)

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

def dfs(l, r):

    if l==r:
        return A[l]
    mid = (l+r)//2
    ans = 1
    ans = ans * dfs(l, mid)
    ans = ans * dfs(mid+1, r)
    return ans

ans = dfs(0, len(A)-1)

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

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

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

print(ans)


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

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

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


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

a = [int(x) for x in input().split(" ")]
ans = 1
fail = False
zero = False
for i in range(N):
	ans*=a[i]
	if(ans>1000000000000000000 or ans<0) :
		fail = True
	elif(a[i]==0) :
		zero = True
		break

if(fail and not zero) :
	print("-1")
else:
	print(ans)

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

a = [int(x) for x in input().split(" ")]
ans = 1
fail = False
zero = False
for i in range(N):
	if(not fail):
		ans*=a[i]
	if(not fail and ans>1000000000000000000 or ans<0) :
		fail = True
	elif(a[i]==0) :
		zero = True
		ans=0
		break

if(fail and not zero) :
	print("-1")
else:
	print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
multi = 1

for i in a:
  multi *= i

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

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

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

# nums = [1,2,3,4,5]
# print(reduce(mul, nums)) #結果=>120

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

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

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

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

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

res = 1
if 0 in a_list:
    print((0))
    exit()

for a in a_list:
    res *= a
    if res > (10 ** 18):
        res = -1
        break
print(res)
# Original solution
eval(input())
l = list(map(int, input().split()))
r = 1
for i in l:
    r *= i
print((-1 if r > 1e18 else r))

# Optimized solution
eval(input())
l = list(map(int, input().split()))
if 0 in l:
    print((0))
else:
    r = 1
    for i in l:
        r *= i
        if r > 1e18:
            break
    print((-1 if r > 1e18 else r))
# Original solution
N = int(eval(input()))
*A, = list(map(int, input().split()))
if 0 in A: print((0))
else:
    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()))
if 0 in A: print((0))
else:
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18: ans = -1; break
    print(ans)
# Original solution
import functools
_ = eval(input())
l = list(map(int, input().split(" ")))

ans = functools.reduce(lambda x, y : x* y, l, 1)

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

# Optimized solution

import sys
_ = eval(input())
l = list(map(int, input().split(" ")))

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

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

print(ans)
# Original solution
from functools import reduce
n = int(eval(input()))
A = list(map(int,input().split()))
b = sorted(A)
if b[0] == 0:
    ans = 0
else:
    ans  = reduce(lambda x,y : x * y, b)
if ans > 10**18:
    print((-1))
else:
    print(ans) 

# Optimized solution
from functools import reduce
n = int(eval(input()))
A = list(map(int,input().split()))
b = sorted(A,reverse=True)
c = 1
if b[-1] == 0:
    c = 0
else:
    for i in range(n):
        if c > 10 ** 18:
            break
        c *= b[i]
    

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

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

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

ans = 1
for i in lis:
    ans *= i
    if ans >= 10**18:
        break

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

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

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

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



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

ans = 1;
for i in range(N):
	ans *= L[i]
  
if ans > 1000000000000000000:
  ans = -1
print(ans)


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

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
ans=1
if A.count(0) >= 1:
  print((0))
else:
  B=[i for i in A if i != 1]
  if len(B) >= 100:
    print("-1")
  else:
    for k in range(len(B)):
      ans=ans*B[k]
    if ans > 1000000000000000000:
      print("-1")
    else:
      print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split())) 
a.sort
p = True
ans = 1 
for i in a : 
  ans *= i 
  if(ans == 0) : 
    print((0))
    p = False 
    break 
if p:
  if ans > 10 **18 : 
    print((-1))
  else:
    print(ans)

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

# Optimized solution
import sys
n = int(eval(input()))
l = list(map(int, input().split(" ")))
l.sort()
a = 1
for i in range(n):
    if a <= 10**18:
        a = a*l[i]
    elif a > 10**18:
        print("-1")
        sys.exit()
if a > 10**18:
    print("-1")
else:
    print(a)
# Original solution
from collections import deque
N = int(eval(input()))
A = deque(list(map(int, input().split())))
ans = 1
for i in range(N):
    ans *= A.pop()
if ans > 10 ** 18:
    print((-1))
else:
    print(ans)

# Optimized solution
#from collections import deque
def hanbun(L):
    N = len(L)
    flag = N % 2
    N = N // 2
    ans = []
    for i in range(N):
        ans.append(L[2 * i] * L[2 * i + 1])
    if flag == 1:
        ans.append(L[-1])
    return(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
while len(A) > 1:
    A = hanbun(A)
ans = A[0]
if ans > 10 ** 18:
    print((-1))
else:
    print(ans)