CodeEff/ECCO huggingface dataset:
# Original solution
def prod(n, A):
    if 0 in A:
        return 0
    p = 1
    for a in A:
        if p * a <= 10**18:
            p *= a
        else:
            return -1
    return p

n = int(eval(input()))
A = [int(i) for i in input().split()]
print((prod(n, A)))

# Optimized solution
import sys
n = int(eval(input()))
A = [int(i) for i in input().split()]
mx = 10**18
if 0 in A:
    print((0))
    sys.exit(0)
p = 1
for a in A:
    if p * a <= mx:
        p *= a
    else:
        print((-1))
        sys.exit(0)
print(p)
# Original solution
# coding: utf-8
# Your code here!
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
N = int(eval(input()))
A = []
A  = list(map(int,input().split()))	
from operator import add, mul, sub,truediv, floordiv
from functools import reduce

i = reduce(lambda x, y: x*y,A)
if i > 1000000000000000000:
    print("-1")
else:
    print(i)
    

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

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

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

As = [int(a) for a in input().split()]


prod = 1

for a in As:
    prod *= a

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


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

As = [int(a) for a in input().split()]


prod = 1
overflow_flag = False

if 0 in As:
    print((0))
else:
    for a in As:
        prod *= a

        if prod > 10**18:
            overflow_flag = True
            break

    if overflow_flag:
        print("-1")
    else:
        print(prod)
# Original solution
n=int(eval(input()))
x=1
lst=list(map(int,input().split()))
for i in lst:
  x*=i
if x<=10**18:
  print(x)
else:
  print('-1')


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

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

ans = 1

min_A = min(A)
A = sorted(A, reverse=True)

if min_A == 0:
    print((0))
    exit()

for a in A:
    ans *= a
    if ans > 10 ** 18:
        break

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


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

# Optimized solution
N = int(eval(input()))
n_list = list(map(int,input().split()))
if 0 in n_list :
  print('0')
else:  
  ans = 1
  tho = 10**18
  for i in range (N):
    ans *= n_list[i]
    if ans > tho :
      print('-1')
      break
  if ans <= tho :
    print(ans)
# Original solution
import sys
input = sys.stdin.readline
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
import sys
input = sys.stdin.readline
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()
else:
    print(ans)
# Original solution
eval(input())
x = list(map(int,input().split()))

a= x[1:]
a2= x[:1]
for i in a:a2.append(a2[-1]*i)

if a2[-1] > 1e18:
	print((-1))
else:
  	print((a2[-1]))

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

# Optimized solution
lenght = int(eval(input()))
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print((0))
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print((-1))
  else:
  	print(first_value)
# Original solution
from operator import mul
from functools import reduce

N = int(eval(input()))
A=list(map(int,input().split()))
s=1
if min(A) == 0:
  s = 0
elif max(A) > 10**18:
  s = -1
else:
  s = reduce(mul, A)
  if s > 10**18:
    s = -1
print(s)

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

from functools import reduce
from operator import add, mul
result =reduce(mul, P)

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


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

    answer = 1
    for a in a_tuple:
        answer *= a
    print((answer if answer <= 10**18 else -1))


if __name__ == '__main__':
    main()


# Optimized solution
def main() -> None:
    n = int(eval(input()))
    a_tuple = tuple(map(int, input().split()))

    if 0 in a_tuple:
        print((0))
        return
    boader = 10 ** 18
    answer = 1
    for a in a_tuple:
        answer *= a
        if answer > boader:
            print((-1))
            return
    print(answer)


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

ans = 1

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

# Optimized solution
n = int(eval(input()))
a_list = list(map(int, input().split()))
a_list_min = sorted(a_list)

ans = 1

for i in range(n):
    ans *= a_list_min[i]
    if ans>10**18:
        ans = -1
        break
print(ans)
# Original solution
from functools import reduce
import operator
_ = eval(input())
M = reduce(operator.mul, [int(v) for v in input().split()])

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

# Optimized solution

_ = eval(input())
N = sorted([int(v) for v in input().split()])
s = 1
for n in N:
    s *= n
    if s == 0 or s > 10**18:
        break

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

print(ans)

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

if a[0] == 0:
  print((0))
  exit()

a.sort(reverse=True)
ans = 1

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

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

if a[0] == 0:
  print((0))
  exit()

a.sort(reverse=True)
ans = 1

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

print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input(). split ()))
if 0 in A:
	print((0))
	exit()
prod = 1
for a in A:
	prod *= a
	if prod > 1000000000000000000:
		print((-1))
		exit()
print(prod)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
c = 1

for i in range(len(a)):
    c = c * a[i]

if c > pow(10,18):
    print((-1))
else:
    print(c)

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

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

for i in range(len(a)):
    c = c * a[i]
    if c > pow(10,18):
        print((-1))
        exit(0)

print(c)
# Original solution
def main():
    _ = eval(input())
    ans = 1

    for i in map(int, input().split()):
        if i == 0:
            print((0))
            return 0
        ans *= i
    if ans > 10 ** 18:
        print((-1))
    else:
        print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
def main():
    _ = eval(input())
    lst = list(map(int, input().split()))
    ans = 1

    if 0 in lst:
        print((0))
        exit()
    for i in lst:
        ans *= i
        if ans > 10 ** 18:
            print((-1))
            exit()
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
from operator import mul
from functools import reduce
O = pow(10, 18)
N = int(eval(input()))
L = list(map(int, input().split()))
M = reduce(mul, L)
if O < M:
    M = -1
print(M)

# Optimized solution
import sys
O = pow(10, 18)
N = int(eval(input()))
L = list(map(int, input().split()))
M = 1

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

for i in range(N):
    M = M * L[i]
    if O < M:
        print((-1))
        sys.exit()
    else:
        continue
print(M)
# Original solution
N = int(eval(input()))
L = list(map(int,input().split()))
Ans = 1
# print(len(L))
for i in L:
    Ans = Ans * i
if (10**18 - Ans) < 0:
     print((-1))
else:
    print(Ans)



# Optimized solution
N = int(eval(input()))
L = list(map(int,input().split()))
dec = 10**18
Ans = 1
# print(len(L))
if(0 in L):
    print((0))
else:
    for i in L:
        Ans = Ans * i
        if dec < Ans:
            print((-1))
            break
    else:
        print(Ans)
# Original solution
N = int(eval(input()))
A = [int(a) for a in 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 = [int(a) for a in input().split()]
if min(A) == 0:
    print((0))
else:
    ans = 1
    M = 10**18
    for i in A:
        ans *= i
        if ans > M:
            print((-1))
            break
    else:
        print(ans)
# Original solution
n =int(eval(input()))
x = list(map(int, input().split()))
if x.count(0) !=0:
  print('0')
else:  
  ans=1
  for i in range(n):
    ans=ans*x[i]
  if ans >10**18:
    print((-1))
  else:
    print(ans)  
    

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

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

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

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

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

A.sort()
cnt = 1
for i in A:
    cnt *= i
    if cnt > 10**18:
        print((-1))
        exit()

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

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

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

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

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

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

print(ans)
# Original solution
from functools import reduce
N = int(eval(input()))
A = list(map(int, input().split()))

tar = reduce(lambda x, y: x*y, A)

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


# Optimized solution

import sys
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

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

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

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


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

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

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

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

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

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


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

ans=1
a.sort()
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()))

res = A[0]



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

if 0 in A:
    res = 0

print(res)

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

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

res = A[0]

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

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



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

result = 1
for a_i in a:
    result *= a_i

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


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

    result = 1
    for a_i in a:
        if a_i == 0:
            return 0

    for a_i in a:
        result *= a_i

        if 10**18 < result:
            return -1

    return result


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

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


# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
         
if(0 in A):
  ans = 0 
else:
  ans = 1       
  for a in A:
    ans *= a
    if(ans > 10**18):
      ans = -1
      break
    if(len(str(ans))>=2):
     if(str(ans)[1] == 'e'):
      ans = -1
      break
         
print(ans)
# Original solution
import functools
import operator
N = int(eval(input()))
A = list(map(int, input().split()))

ans = functools.reduce(operator.mul, A)
    
if len(str(ans)) < 19:
  print(ans)
elif ans == 1000000000000000000:
  print(ans)
else:
  print((-1))

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

def main(A):
  if 0 in A:
    print((0))
    return
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print((-1))
      return
  print(prod)
    
main(A)
# Original solution
N=int(eval(input()))
l=list(map(int,input().split()))
v=1
for i in range(N):
    v*=l[i]
if v>10**18:
    print('-1')
else:
    print(v)


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


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

# Optimized solution
x=10**18
n=int(eval(input()))
A=list(map(int,input().split()))
ans=1
if 0 in A:
    ans=0
else:
    for a in A:
        ans*=a
        if ans>x:
            ans=-1
            break
print(ans)
# Original solution
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
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
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
n=int(eval(input()))
a= list(map(int, input().split()))
ans=1
if 0 in a:
    print((0))
    sys.exit()
for i in range(n):
    ans*=a[i]
    if ans>10**18:
        print((-1))
        sys.exit()

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

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

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

print(res)

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

res = 1
if 0 in a:
    print((0))
else:
    for i in range(n):
        res *= a[i]
        if res > 10**18:
            res = -1
            break
    print(res)
# Original solution
#!/usr/bin/python

import sys
import math 

#Input Functions
#===============

input = sys.stdin.readline

def inp():
    return(int(eval(input())))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = eval(input())
    return(list(s[:len(s) - 1]))
def invr():
    return(list(map(int,input().split())))

#===============

def run_test() :
    n = inp()
    a = inlt()
    ans = 1
    zero = False
    invalid = False
    for i in a :
        ans *= i
        if i == 0 : zero = True
        if ans > 1000000000000000000 : invalid = True
    if zero : ans = 0
    elif invalid : ans = -1
    print(ans)

def main() :
	run_test()

if __name__ == '__main__' :
	main()


# Optimized solution
#!/usr/bin/python

import sys
import math 

#Input Functions
#===============

input = sys.stdin.readline

def inp():
    return(int(eval(input())))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = eval(input())
    return(list(s[:len(s) - 1]))
def invr():
    return(list(map(int,input().split())))

#===============

def run_test() :
    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 > 1000000000000000000:
            print((-1))
            return
    print(prod)

def main() :
	run_test()

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

# Optimized solution
# import numpy as np
n = int(eval(input()))
a_lst = list(map(int, input().split()))
x = 10 ** 18

# ans = np.prod(a_lst)



ans = 1
if 0 in a_lst:
    # print("a")
    ans = 0
else:
    for i in range(n):
        ans *= a_lst[i]
        if ans > x:
            ans = -1
            break
        # elif ans == 0:
        #     break
    
# if ans > x:
#     print(-1)
# else:
#     print(ans)
print(ans)