CodeEff/ECCO huggingface dataset:
# Original solution
def main ():
    N = int(eval(input()))
    A = list(map(int,input(). split ()))
    if 0 in A:
        print((0))
        return
    prod = 1
    for a in A:
        prod *= a
    if prod > 1000000000000000000:
        print((-1))
        return
    print(prod)
main ()

# Optimized solution
def main ():
    N = int(eval(input()))
    A = list(map(int,input(). split ()))
    if 0 in A:
        print((0))
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print((-1))
            return
    print(prod)
main ()
# Original solution
n = int(eval(input()))
lists = list(map(int,input().split()))
ans = 1
for i in range(n):
    ans *= lists[i]
    if sorted(lists)[0] == 0:
        ans = 0
        break
    if ans > 10**18:
        ans = -1
        break
print(ans)

# Optimized solution
n = int(eval(input()))
lists = list(map(int,input().split()))
ans = 1
if sorted(lists)[0] == 0:
    ans = 0
else:
    for i in range(n):
        ans *= lists[i]
        if ans > 10**18:
            ans = -1
            break
print(ans)
# Original solution
# Nの入力
N = int(eval(input()))

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

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

# Optimized solution
# Nの入力
N = int(eval(input()))

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

result = 1
if 0 in A:
    result = 0
else:
    for i in A:
        result *= i
        if result > 10 ** 18:
            result = -1
            break
print(result)
# Original solution
import sys
N=int(sys.stdin.readline().strip())
A=list(map(int, sys.stdin.readline().split()))

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

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


# Optimized solution
import sys
N=int(sys.stdin.readline().strip())
A=list(map(int, sys.stdin.readline().split()))

ans=1
for a in A:
    if a==0:
        ans*=a
    elif ans==-1:
        pass
    else:
        ans*=a
        if 10**18<ans:
            ans=-1

if 10**18<ans:
    print(-1)
else:
    print(ans)
# Original solution
n = int(eval(input()))
a = tuple(map(int, input().split()))
x = 1
for aa in a:
    x *= aa
if x > 10 ** 18:
    print((-1))
else:
    print(x)


# Optimized solution
n = int(eval(input()))
a = tuple(sorted(map(int, input().split())))
x = 1
for aa in a:
    x *= aa
    if x > 10 ** 18:
        print((-1))
        exit(0)
print(x)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
ans = 1;
flg = True
A.sort()
for i in range(N):
    ans*=A[i]
    if(ans>1000000000000000000):
        flg = False
if(flg):
    print(ans)
else:
    print((-1))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
ans = 1;
flg = True
A.sort()
for i in range(N):
    ans*=A[i]
    if(ans>1000000000000000000):
        flg = False
        break
if(flg):
    print(ans)
else:
    print((-1))
# 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))
    exit()
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>10**18:
        print((-1))
        exit()
print(ans)
# Original solution
n = int(eval(input()))
arr = list(map(int, input().split()))

ans = 1
for x in arr:
    ans *= x

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

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

ans = 1

for x in arr:
    if x == 0:
        ans = 0

if ans == 0:
    print(ans)
else:
    for x in arr:
        ans *= x
        if ans > 1000000000000000000:
            break
    if ans > 1000000000000000000:
        print((-1))
    else:
        print(ans)
# Original solution
i=input;i();l=i().split();x=1-('0'in l)
for j in l:x*=int(j);
if x>1e18:x=-1
print(x)

# Optimized solution
i=input;i();l=i().split();x=not'0'in l
for j in l:
  x*=int(j);
  if x>1e18:x=-1;break
print(x)
# Original solution
eval(input());l=input().split();x=1
for j in sorted(l):x*=int(j);
if x>1e18:x=-1
print(x)

# Optimized solution
eval(input());l=input().split();x=1
for j in sorted(l):
  x*=int(j)
  if x>1e18:x=-1;break
print(x)
# Original solution
eval(input());l=input().split();x=1
for j in sorted(l):
  x*=int(j)
  if x>1e18:x=-1;break
print(x)

# Optimized solution
eval(input());l=input().split();x=not"0"in l
for j in l:x=x*int(j)if 0<=x*int(j)<=1e18else-1
print(x)
# Original solution
import operator
from functools import reduce

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

    ans = reduce(operator.mul, A, 1)
    
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)
    
if __name__ == "__main__":
    main()


# Optimized solution
import operator
from functools import reduce

def main():
    N = int(eval(input()))
    A = list(map(int, 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)
    
if __name__ == "__main__":
    main()
# Original solution
N=int(eval(input()))
X=list(map(int, input().split()))

ans=1
if 0 in X:
    print((0))
else:
    X.sort()
    for i in X:
        ans *= i
        if 1e18<ans:
            print((-1))
            break
    else:
        print(ans)    

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

ans=1
if 0 in X:
    print((0))
else:
    for i in X:
        ans *= i
        if 1e18<ans:
            print((-1))
            break
    else:
        print(ans)
# Original solution
N=int(eval(input()))
X=list(map(int, input().split()))

ans=1
if 0 in X:
    print((0))
else:
    for i in X:
        ans *= i
        if 1e18<ans:
            print((-1))
            break
    else:
        print(ans)    

# Optimized solution
N=int(eval(input()))
X=input().split()

ans=1
if "0" in X:
    print((0))
else:
    for i in X:
        ans = int(i) * ans
        if 1e18<ans:
            print((-1))
            break
    else:
        print(ans)
# Original solution
N=int(eval(input()))
X=input().split()

ans=1
if "0" in X:
    print((0))
else:
    for i in X:
        ans = int(i) * ans
        if 1e18<ans:
            print((-1))
            break
    else:
        print(ans)    

# Optimized solution
def main():
    N=int(eval(input()))
    X=input().split()
    if "0" in X:
        print((0))
        return
    ans=1
    for i in X:
        ans = int(i) * ans
        if 1e18<ans:
            print((-1))
            return
    print(ans)
main()
# Original solution
def main():
    N=int(eval(input()))
    X=input().split()
    if "0" in X:
        print((0))
        return
    ans=1
    for i in X:
        ans = int(i) * ans
        if 1e18<ans:
            print((-1))
            return
    print(ans)
main()

# Optimized solution
def main():
    N=int(eval(input()))
    X=input().split()
    if "0" in X:
        print((0))
        return
    ans=1
    for i in X:
        ans = int(i) * ans
        if 1000000000000000000<ans:
            print((-1))
            return
    print(ans)
main()
# Original solution
import functools
import operator
f = functools.partial(functools.reduce, operator.mul)
n = int(eval(input()))
a = list(map(int,input().split()))
ans = f(a)

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

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[n-1] == 0:
    print("0")
    exit()
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)
# Original solution
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    acc = functools.reduce(lambda x,y:x*y, a)
    if 10**18 < acc:
        acc = -1

    return acc

if __name__ == "__main__":
    n = int(eval(input()))
    a = list(map(int,input().split()))
    acc = functools.reduce(lambda x,y:x*y, a)
    if 10**18 < acc:
        acc = -1
    print(acc)
    #print(multiplication2(n,a))


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

def multiplication2(n,a):
    #acc = functools.reduce(lambda x,y:x*y, a)
    acc = 1
    a_sorted = sorted(a)
    if a_sorted[0] == 0:
        return 0
    
    for s in a_sorted:

        acc = acc*s
        if 10**18 < acc:
            acc = -1
            break
    return acc

if __name__ == "__main__":
    n = int(eval(input()))
    a = list(map(int,input().split()))
    print((multiplication2(n,a)))
# Original solution
n = int(eval(input()))
a = [int(x) for x in input().split()]
m = 1;
for i in range(n):
  m *= a[i];
if m > 1e+18: print((-1))
else: print(m)

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

#n = int(input())
#a,b = map(int,input().split())
a_L = list(map(int,input().split()))
ans = 1
for i in range(n):
    ans = ans*a_L[i]
if ans > 10**18:
    print((-1))
    exit()

print(ans)

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

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

a_L = list(sorted(a_L))
if a_L[0] == 0:
    print((0))
    exit()

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

print(ans)
# Original solution
import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

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

if A.count(0):
    print((0))
else:
    for a in A:
        mal = mal * a
    if mal <= 10 ** 18:
        print(mal)
    else:
        print((-1))

# Optimized solution
import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

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

    if A.count(0):
        print((0))
        return

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

Main()
# Original solution
import math
import sys
import functools
import operator

n = int(eval(input()))
a = list(map(int, input().split()))
sumans = functools.reduce(operator.mul, a)

INF = 1000000000000000000
if (sumans > INF):
    print((-1))
else:
    print(sumans)


# Optimized solution
import math
import sys
import functools
import operator

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


ans = 1
INF = 1000000000000000000

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

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

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

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

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

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

ans = 10**18
prod = 1
f = 0
f2 = 0

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

if f == 1:
    print((0))

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

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

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

ans = 1000000000000000000
prod = 1
f = 0
f2 = 0

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

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

    if prod > ans:
        f2 = 1
        break

if f == 1:
    print((0))

else:
    if f2 == 1:
        print((-1))
    else:
        print(prod)
# Original solution
n = int(input())
A = list(map(int, input().split()))

from operator import mul, xor
from functools import reduce

def grow(arr):
    return reduce(mul, arr)

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


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

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

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

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
answer = 1
for i in A:
    answer *= i
    if answer > 10 ** 18:
        break

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

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

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

# Optimized solution
import sys

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[-1] == 0):
  print((0))
else:
  p = 1
  for An in A:
    p *= An
    if(p > 10 ** 18):
      print((-1))
      sys.exit()
  print(p)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
b = 0
import math
for i in range(N):
  if A[i] > 0 and ans >0:
    if math.log10(A[i])+math.log10(ans)>18:
    
      ans = -1
      b = 1
    else:
      ans *= A[i]
  else:
    ans *= A[i]

if ans == 0:
  print(ans)
elif b == 1:
  print((-1))
elif ans>10**18:
  print((-1))
else:
  print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
n0 = A.count(0)
n1 = A.count(1)
import math
ans = 1
if N-n0-n1>60:
  ans = -1
for i in range(N):
  if A[i] == 0 or ans == 0:
    ans = 0
    break
  elif ans <0:
    ans = -1
  elif math.log10(A[i])+math.log10(ans)>18:
    ans = -1
    b = 1
  else:
    ans *= A[i]

if ans == 0:
  print((0))
elif ans < 0:
  print((-1))
elif ans>10**18:
  print((-1))
else:
  print(ans)
# Original solution
n=int(eval(input())) 
c=list(map(int, input().split()))

ans = 1
for i in range(n):
    ans *= c[i]
    
if ans > 1000000000000000000:
        print('-1')
else:
    print(ans)
 

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

ans = 1
if 0 in c:
    print('0')
    exit()

for i in range(n):
    ans *= c[i]
    if ans > 1000000000000000000:
        print('-1')
        exit()

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

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


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

if A.count(0):
    print((0))
    import sys
    sys.exit()

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

print(ans)
# Original solution
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: list(map(int, readline().split())) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = nl()
ans = 1
for ele in a:
    ans *= ele

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

# Optimized solution
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: list(map(int, readline().split())) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = sorted(nl())
ans = 1
for ele in a:
    ans *= ele
    if ans > 10 ** 18:
        break

if ans > 10 ** 18:
    print((-1))
else:
    print(ans)
# Original solution
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e25)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input())

N = I()
a = IL()

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

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

# Optimized solution
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e25)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return eval(input())

N = I()
a = IL()

ans = 1
cnt = a.count(0)
if cnt:
  print((0))
else:
  for i in range(N):
    ans *= a[i]
    if ans > int(1e18):
      print((-1))
      break
  else:
    print(ans)
# Original solution
import functools
import operator
n=int(eval(input()))
a=list(map(int,input().split()))
ans=functools.partial(functools.reduce,operator.mul)
print((-1 if ans(a)>10**18 else ans(a)))

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

print(ans)
# Original solution
from functools import reduce
from operator import mul

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

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

a_li = [a for a in a_li if a != 1 and a != 0]
a_li.append(1)
ans = reduce(mul, a_li)

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


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

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

ans = 1
a_li = [a for a in a_li if a != 1 and a != 0]
a_li.append(1)
for a in a_li:
    ans *= a
    if ans > 1000000000000000000:
        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>10**18:
    print((-1))
    exit()
print(ans)

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

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

# Optimized solution
n= int(eval(input()))
l= list(map(int,input().split()))
if 0 in l:
    print((0))
    exit()
pro = l[0]
for i in range(1,n):
    pro *= l[i]
    if pro > 10**18:
        print('-1')
        exit()
print(pro)
# Original solution
import math
n = 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
import math
n = eval(input())
A = list(map(int,input().split()))

ans = 1

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

if 0 in A:
    ans = 0

print(ans)
# Original solution
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list([x-1 for x in MII()])
#======================================================#
def main():
    n = II()
    aa = MII()
    t = 1
    for a in aa:
        t *= a
    if t > 10**18:
        print((-1))
    else:
        print(t)

if __name__ == '__main__':
    main()

# Optimized solution
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list([x-1 for x in MII()])
#======================================================#
def main():
    n = II()
    aa = MII()
    t = 1
    if 0 in aa:
        print((0))
        return None
    for a in aa:
        t *= a
        if t > 10**18:
            print((-1))
            return None
    print(t)

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

r = 1
for num in a:
  r *= num

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


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

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

r = 1
for num in a:
  r *= num
  if r > 1e18:
    print((-1))
    sys.exit()

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

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

# 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
print(ans)