CodeEff/ECCO huggingface dataset:
# Original solution
from functools import reduce
from operator import mul
import sys

input = sys.stdin.readline

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

for i in range(n):
    if An[i] == 0:
        print((0))
        quit()

j = 1000000000000000000
ans = 1
ans = reduce(mul, An)


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



# Optimized solution

n = int(eval(input()))
An = [int(x) for x in input().split()]
An.sort(reverse=True)

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

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

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

      break
  if flag:
    print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

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

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

A.sort()

X = 1
for i in range(N):
    X *= A[i]
    if X > 10**18:
        print((-1))
        break
else:
    print(X)
# 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)
else:
  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 *= a[i]
    if ans > pow(10,18):
        ans = -1
        print(ans)
        break
  if ans != -1:
    print(ans)
# Original solution
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from sys import stdin
input = stdin.readline


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    ans = 1

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


if __name__ == '__main__':
    main()

# Optimized solution

def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    ans = 1

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


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

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

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
A = sorted(A)
flag = False
answer = 1
for a in A:
    if A[-1] == 0:
        answer = 0
        break
    else:
        answer *= a
        if answer > 10 ** 18:
            flag = True
            break

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

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

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


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 cal in a:
        ans *= cal
        if ans > 1e18:
            print((-1))
            return
    print(ans)

main()
# Original solution
n=int(eval(input()))
A=list(map(int,input().split()))
ans=1
for i in range(0,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
for i in range(n):
  if A[i]==0:
    print((0))
    exit()
for i in range(n):
  if len(str(A[i]))>19:
    print((-1))
    exit()
  ans*=A[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 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(reverse=True)
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        if a[n-1] == 0:
            ans = 0
        else:
            ans = -1
        break

print(ans)
# Original solution
N=int(eval(input()))
a=list(map(int,input().split()))
ans=1
for x in a:
    ans*=x

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


# Optimized solution
N=int(eval(input()))
a=list(map(int,input().split()))
flag=0
ans=1
if min(a)==0:
    ans=0
else:
    for x in a:
        ans*=x
        if ans>10**18:
            flag=1
            break
if flag==1:
    print((-1))
else:
    print(ans)
# Original solution
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
int(eval(input()))
A=list(map(str,input().split()))
ans=1
if '0' in A:
  print('0')
  exit()
for i in A:
  ans*=int(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 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
count = 0
if 0 in A:
    print((0))
else:
    for i in range(n):
        ans *= A[i]
        if ans > 10**18:
            count = 1
            print((-1))
            break
    if count == 0:
        print(ans)
# Original solution
from operator import add, mul, sub,truediv, floordiv
from functools import reduce

import sys
input = sys.stdin.readline

N = int(eval(input()))
A = list(map(int,input().split()))
ans = reduce(mul, 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))
    exit()
ans = 1

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

print(ans)
# Original solution
import sys
N = int(eval(input()))
A = list(map(int, input().split()))
m = 1

for item in A:
    m *= item

if m > 10 ** 18:
    print("-1")
    sys.exit()
print(m)

# Optimized solution
import sys
N = int(eval(input()))
A = list(map(int, input().split()))
m = 1
if 0 in A:
    print((0))
    sys.exit()

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

# Optimized solution
N = int(eval(input()))
As = list(map(int,input().split()))
sum = 1
if 0 in As:
    print((0))
    exit()
for i in As:
    sum *=i
    if sum>10**18:
        sum = -1
        break
print(sum)
# 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()))

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

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

# Optimized solution
n = int(eval(input()))
l = list(map(int,input().split()))
s = 1
f = 1
x = 1000000000000000000
l.sort()
if l[0]==0:
  print((0))
elif l[0]==1 and l[-1]==1:
  print((1))
else:
  l = l[::-1]
  for i in l:
      s *= i
      if s>x:
          print((-1))
          f = 0
          break
  if f==1:
    print(s)
# Original solution
n = int(eval(input()))
lis = list(map(int, input().split()))
res = 1
for i in lis:
    res *= i
print((res if res <= 10**18 else -1))


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

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

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

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

flag = 0

if 0 in A:
    print((0))
else:
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            flag = 1
            break
    if flag == 0:
        print(ans)
    else:
        print((-1))
# Original solution
num = int(eval(input()))
numList = list(map(int, input().split()))
max = 1000000000000000000
flg = True
result = 1

if 0 in numList:
    print((0))
else:
    for i in range(num):
        result *= numList[i]
    
    if result > max:
        flg = False
    if flg:
        print(result)
    else:
        print((-1))


# Optimized solution
num = int(eval(input()))
numList = list(map(int, input().split()))
max = 1000000000000000000
flg = True
result = 1

if 0 in numList:
    print((0))
else:
    for i in range(num):
        result *= numList[i]
        if result > max:
            flg = False
            break
    if flg:
        print(result)
    else:
        print((-1))
# Original solution
import sys
N = int(input())
array = list(map(int,input().split()))

if not ( 2 <= N <= 10**5 ): sys.exit()
if not ( 0 <= min(array) and max(array) <= 10**18): sys.exit()

sum = array[0]
for I in range(1,len(array)):
    sum *= array[I]
print(sum) if sum <= 10**18 else print(-1)


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

if not ( 2 <= N <= 10**5 ): sys.exit()
if not ( 0 <= min(array) and max(array) <= 10**18): sys.exit()
if 0 in array: print((0)); sys.exit()

sum = array[0]
for I in range(1,len(array)):
    sum *= array[I]
    if sum > 10**18: print((-1));sys.exit()
print(sum)
# Original solution
n = int(eval(input()))
l = list(map(int, input().split()))
b = 1
def multi(n,b,l):
    for i in range(n):
        b = b * l[i] 
    if b > 10 ** 18:
        b = -1
    return b
b = multi(n,b,l)
print(b)

# Optimized solution
import sys
sys.setrecursionlimit(1000000)

def input():
    return sys.stdin.readline()[:-1]
n = int(eval(input()))
l = list(map(int, input().split(" ")))
output = 1

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

for i in range(n):
    output = output * int(l[i])
    if output > 10 ** 18:
        output = -1
        break
print(output)
# Original solution
# coding: utf-8
# Your code here!
N=int(eval(input()))
List = list(map(int, input().split()))

ANS=List[0]
i=1
while i<N:
    ANS=ANS*List[i]
    i+=1

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





# Optimized solution
# coding: utf-8
# Your code here!
N=int(eval(input()))
List = list(map(int, input().split()))
List=sorted(List)
List=List[::-1]
#print(List)
if List.count(0)!=0:
    print((0))
    quit()
ANS=List[0]
i=1
while i<N:
    ANS=ANS*List[i]
    if ANS>1000000000000000000:
        print((-1))
        quit()
    i+=1

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

b1=1
b2=0
b3=0
for i in range(n):
  b1*=a[i]
  b2*=a[i]
  b3*=a[i]
  if b1>=10**9:
    b2+=b1//(10**9)
    b1%=10**9
  if b2>=10**9:
    b3+=b2//(10**9)
    b2%=10**9
  
if b3>=1 and (b1!=0 or b2!=0):
  print((-1))
else:
  print((b3*(10**18)+b2*(10**9)+b1))

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

b1=1
b2=0
b3=0

if 0 in a:
  print((0))
else:
  for i in range(n):
    b1*=a[i]
    b2*=a[i]
    if b1>=10**9:
      b2+=b1//(10**9)
      b1%=10**9
    if b2>=10**9:
      b3+=b2//(10**9)
      b2%=10**9
      break
  
  if b3>=1 and (b1!=0 or b2!=0):
    print((-1))
  else:
    print((b3*(10**18)+b2*(10**9)+b1))
# Original solution
# Multiplication2
import math
N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
for a in A:
    ans *= a
ans = [-1, ans][ans <= 10**18]
print(ans)

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

# Optimized solution
import sys

n = int(eval(input()))
a = [int(i) for i in input().split()]
prd = 1
if 0 in a:
  print((0))
  sys.exit()
for i in range(n):
  prd*=a[i]
  if prd > 10**18:
    print((-1))
    sys.exit()
print(prd)
# Original solution
def multiply2(A):
    res = 1
    for item in A:
        res *= item
    if res > 10**18:
        return '-1'
    else:
        return res

if __name__ == "__main__":
    N = int(eval(input()))
    A = []
    A = list(map(int, input().split()))
    print((multiply2(A)))

# Optimized solution
def multiply2(A):
    res = 1
    if 0 in A:
        return 0
    for item in A:
        res *= item
        if res > 10**18:
            return -1
    return res

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


# Optimized solution
N=int(eval(input()))
A = list(map(int,input().split()))
A.sort()
x=1
y=True
for i in A:
    x= x*i
    if x > 10**18:
        print('-1')
        y=False
        break
if y:
    print(x)
# 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()))

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

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

for i in range(n):
    answer = a[i] * answer
    if a[i] == 0:
        print(answer)
        break
    elif answer > 1000000000000000000 and n == i+1:
        print((-1))
        break
    elif n == i+1:
        print(answer)


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
answer = 1
zero_check = 0 in a

for i in range(n):
    answer = a[i] * answer
    if zero_check:
        print((0))
        break
    elif answer > 1000000000000000000:
        print((-1))
        break
else:
    print(answer)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
sum=1
for i in range(n):
    if a[i]==0:
        print((0))
        exit()
    sum*=a[i]
if sum>10**18:
        print((-1)) 
        exit()  
print(sum)


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

for i in range(n):
    x=a[i]
    if x==0:
        print((0))
        exit()
    if not check==-1:
        sum*=x
        if sum>10**18:
            check=-1
if check==-1:
        print((-1)) 
        exit()  
print(sum)
# Original solution


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

ans=1
v=True
for i in arr:
    ans=ans*i

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


# Optimized solution


n=int(eval(input()))
arr=list(map(int,input().split()))
arr.sort()
ans=1
v=True
for i in arr:
    ans=ans*i
    if ans==0:
        v=False
        print((0))
        break
        
    if ans>1000000000000000000:
        v=False
        print((-1))
        break

if v:
    print(ans)
# Original solution
N = int(eval(input()))
lst = list(map(int, input().split()))
if (0 in lst):
  print((0))
else:
  product = 1
  for i in lst: #iというlist中の数字
    product *= i #これが(i + 1)番目

  if(product > 1000000000000000000):
      #これをfor文に書くことで掛け終える前に超えたらやめることができる（処理を短縮できる！）
    print((-1))
  else:
    print(product)

# Optimized solution
N = int(eval(input()))
lst = list(map(int, input().split()))
if (0 in lst):
  print((0))
else:
  product = 1
  for i in lst: 
    product *= i

    if(product > 1000000000000000000):
      print((-1))
      break
  else:
    print(product)
# Original solution
from operator import mul
from functools import reduce

N = int(eval(input()))
input_list = [int(i) for i in input().split()]

sum_num = reduce(mul, input_list)

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

# Optimized solution
N = int(eval(input()))
input_list = [int(i) for i in input().split()]
max_num = 10 ** 18

sum_num = 1
if 0 in input_list:
    print('0')
else:
    for i in input_list:
        sum_num *= i
        if sum_num > max_num:
            sum_num = -1
            break
    print(sum_num)
# Original solution
from operator import mul
from functools import reduce
n = int(eval(input()))
a = list(map(int,input().split()))
 
if 0 in a:
	print((0))
else:
	M = 10**18
	ans = reduce(mul, a)
	if ans > M:
		print((-1))
	else:
		print(ans)

# Optimized solution
n = int(eval(input()))
s = sorted(map(int,input().split()))
M = 10 ** 18
ans = 1
for ss in s:
	ans *= ss
	if ans > M:
		ans = -1
		break
	elif ans == 0:
		break
print(ans)
# Original solution
import functools
import operator

n = int(eval(input()))
a = [int(i) for i in input().split(' ')]
if a[0] == 0:
    print((0))
else:
    x = functools.reduce(operator.mul, a)
    if x > 10**18:
        print((-1))
    else:
        print(x)


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

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

# Optimized solution
a = int(eval(input()))
b = list(map(int, input().split()))
b = sorted(b)
c = b[0]
if c == 0:
  print(c)
  exit()
else:
  for i in range(a-1):
    c *= b[i+1]
    if c > 1000000000000000000:
      break

if c > 1000000000000000000:
  print((-1))
else:
  print(c)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
result = 1

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

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

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

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

print(result)
# Original solution
import sys
_ = int(sys.stdin.readline().strip())                 
xs = [int(x) for x in sys.stdin.readline().split(" ")]
r = 1                                                 
for x in xs:                                          
    r *= x                                            
if r > 10 ** 18:                                      
    print("-1")                                       
else:                                                 
    print(r)                                          

# Optimized solution
import sys
def calc():                                             
    _ = int(sys.stdin.readline())                       
    xs = [int(x) for x in sys.stdin.readline().split(" ")]
    for x in xs:                                          
        if x == 0:                                        
            return 0                                      
    r = 1                                                 
    m = 10 ** 18                                          
    for x in xs:                                          
        r *= x                                            
        if r > m:                                         
            return -1                                     
    return r                                              
                                                          
print((calc()))
# Original solution
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)
N = int(eval(input()))
A = list(map(int, input().split()))
RedWine = prod(A)
if RedWine > 1000000000000000000:
    print((-1))
else:
    print(RedWine)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
RedWine = 1
for i in range(N):
    RedWine *= A[i]
    if RedWine > 1000000000000000000:
        break
if RedWine > 1000000000000000000:
    if A.count(0) == 0:
        print((-1))
    else:
        print((0))
else:
    print(RedWine)
# Original solution
n=int(eval(input()))
alis=sorted(list(map(int,input().split())))
p=alis[0]
if p==0:
  print((0))
  exit()
for i in range(1,n):
  p*=alis[i]
  
if len(list(str(p)))>18:
  sa=list(map(int,list(str(p))))
    
  if sum(sa)!=1:
    print((-1))
    exit()
print(p)

# Optimized solution
n=int(eval(input()))
alis=sorted(list(map(int,input().split())))
p=alis[0]
if p==0:
  print((0))
  exit()
bre=False
for i in range(1,n):
  p*=alis[i]
  
  
  if len(list(str(p)))>18:
    bre=True
    break


if bre:
  sa=list(map(int,list(str(p))))
  if sum(sa)!=1:print((-1))
  else:print(p)
else:print(p)
# Original solution
n = int(eval(input()))

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

i = 0
x = 1
while i < n:
    x = x * a[i]
    i += 1

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

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

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

i = 0
x = 1
while i < n:
    x = x * a[i]
    i += 1
    if x > 1000000000000000000:
        print((-1))
        exit()

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

sum = 1
for num in nums:
    sum *= num

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

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

sum = 1
if 0 in nums:
    print((0))
else:
    for num in nums:
        sum *= num
        if sum > 10 ** 18:
            print((-1))
            break
    else:
        print(sum)
# Original solution
import sys

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))
    sys.exit()

print(ans)


# Optimized solution
import sys

n = int(eval(input()))

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

ans = 1

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

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

print(ans)