CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n-1):
  a[i+1]*=a[i]
print((a[i+1] if a[i+1]<=10**18 else -1))


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
s = 1
if 0 in a:
    print((0))
    exit()
for i in range(n):
  s *= a[i]
  if s>10**18:
      print((-1))
      exit()
print(s)
# Original solution
n=int(eval(input()))
list=[int(i) for i in input().split()]
x=list[0]
k=1
while k<n:
  y=x*list[k]
  x=y
  k=k+1
if y>1000000000000000000:
  print((-1))
else:
  print(y)

# Optimized solution
n=int(eval(input()))
list=[int(i) for i in input().split()]
k=1
list.sort()
x=list[0]
while k<n:
  y=x*list[k]
  x=y
  if y<=1000000000000000000:
    k=k+1
  else:
    k=n+1
    y=-1
print(y)
# Original solution
def main():
  n = int(eval(input()))
  nums = list(map(int, input().split()))
  result = 1
  if 0 in nums:
    print((0))
    return
  else:
    for i in nums:
      result *= i
    if result > 1000000000000000000:
      print((-1))
      return
    else:
      print(result)
      return


if __name__ == "__main__":
  main()

# Optimized solution
def main():
  n = int(eval(input()))
  nums = list(map(int, input().split()))
  result = 1
  if 0 in nums:
    print((0))
    return
  else:
    for i in nums:
      result *= i
      if result > 1000000000000000000:
        print((-1))
        return
    print(result)
    return


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

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

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

mul = 1
for i in range(n):
  mul *= a[i]
  if (mul > 1000000000000000000):
  	print((-1))
  	exit(0)

print(mul)
# Original solution
n=int(eval(input()))
l=list(map(int,input().split()))
if min(l)== 0:
    print((0))
else:    
    s=1
    for x in l:
        s *= x
    
    if s>1000000000000000000:
        print((-1))
    else:
        print(s)

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

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

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

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

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

res = 1
if 0 in A:
  print((0))
  exit()
else:
  for i in A:
    res *= i
    if res > 10 ** 18:
      print((-1))
      exit()
print(res)
# Original solution
# B - Multiplication 2
from functools import reduce
from operator import mul


def main():
    _, *A = list(map(int, open(0).read().split()))
    prod = reduce(mul, A)
    print((prod if prod <= 10 ** 18 else -1))


if __name__ == "__main__":
    main()


# Optimized solution
# B - Multiplication 2
def main():
    _, *A = list(map(int, open(0).read().split()))
    if 0 in A:
        print((0))
        return 
    prod = 1
    LIM = 10 ** 18
    for i in A:
        prod *= i
        if prod > LIM:
            print((-1))
            return
    print(prod)


if __name__ == "__main__":
    main()
# Original solution
# B - Multiplication 2
def main():
    _, *A = list(map(int, open(0).read().split()))
    if 0 in A:
        print((0))
        return 
    prod = 1
    LIM = 10 ** 18
    for i in A:
        prod *= i
        if prod > LIM:
            print((-1))
            return
    print(prod)


if __name__ == "__main__":
    main()


# Optimized solution
# B - Multiplication 2
def main():
    _, *A = open(0).read().split()
    if "0" in A:
        print((0))
        return
    prod = 1
    LIM = 10 ** 18
    for i in A:
        prod *= int(i)
        if prod > LIM:
            print((-1))
            return
    print(prod)


if __name__ == "__main__":
    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 > 1e18:
  ans = -1
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
check = (0 in A)
if check:
  print((0))
else:
  for i in range(N):
    ans *= A[i]
    if ans > 1e18:
      ans = -1
      break
  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()))
ans = 1
mark = False
if 0 in a:
    print((0))
    mark = True
if mark==False:
    for i in range(n):
        ans *= a[i]
        if ans > 1000000000000000000:
            mark = True
            print((-1))
            break
if not mark: print(ans)
# Original solution
n = int(eval(input()))
al = list(map(int, input().split()))

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

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

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

ans = 1
if al.count(0) > 0:
    print((0))
else:
    for a in al:
        ans *= a
        if ans > 10**18:
            print((-1))
            break
    else:
        print(ans)
# Original solution
N = int(eval(input()))
A = [int(s) for s in 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 = [int(s) for s in input().split()]

ans = 1
if 0 in A:
    ans = 0
else:
    for a in A:
        ans *= a

        if ans > 10 ** 18:
            ans = -1
            break

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

# Optimized solution
n = int(eval(input()))
A = list(map(int,input().split()))
num = 1
flag = True
if A.count(0)>=1:
    print((0))
else:
    for i in A:
        num *= i
        if num > pow(10,18):
            print((-1))
            flag =False
            break

    if flag:
        print(num)
# Original solution
import functools
import operator

n = int(eval(input()))
number = list(map(int,input().split()))
X = functools.partial(functools.reduce, operator.mul)

s=X(number)
if s>pow(10,18):
    print((-1))
else:
    print(s)

# 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()))
an = list(map(int, input().split()))

ans = 1

for i in an:
    
    ans *= i
    
else:
    print((ans if ans <= 10 ** 18 else -1))

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

ans = 1

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

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
ans = 1
for i in a:
    ans=ans*i
    if ans>1000000000000000000:
        print((-1))
        exit()
    

print(ans)
# Original solution
import functools
import operator

N = int(eval(input()))
n_list = a = list(map(int,input().split()))
result = functools.reduce(operator.mul, n_list)
if result > 10 ** 18:
    print((-1))
else:
    print(result)

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

input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
l = (10 ** 18)
if 0 in a:
    print((0))
    exit()
c = reduce(mul, a)
if c > l:
    print((-1))
else:
    print((reduce(mul, a)))

# Optimized solution
import sys

input = sys.stdin.readline

N = int(eval(input()))
a = list(map(int, input().split()))
if 0 in a:
    print((0))
    exit()
c = 1
l = 10 ** 18
for i in a:
    c *= i
    if c > l:
        print((-1))
        exit()

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


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
count = 1
l = 0
if (0 in a) == True:
  print((0))
else:
  for i in a:
    count *= i
    if count > 1000000000000000000:
      l = -1
      break
  if l == 0:
    print(count)
  else:
    print(l)
# Original solution
N = int(eval(input()))
input_list = input().split()
result = 1
for i in input_list:
    result *= int(i)
if result > 10 ** 18:
    print((-1))
else:
    print(result)

# Optimized solution
import sys
N = int(eval(input()))
input_list = input().split()
result = 1
max = 10 ** 18
if '0' in input_list:
    print((0))
else:
    for i in input_list:
        result *= int(i)
        if result > max:
            print((-1))
            sys.exit(0)
    print(result)
# Original solution
str = eval(input())
str2 = input().split(" ")

ans = 1
for x in str2:
    ans = ans * int(x)

if(ans > 1000000000000000000):
    ans = -1

print(ans)

# Optimized solution
num = int(eval(input()))
str2 = input().split(" ")
nums = [int(s) for s in str2]
nums.sort()

ans = 1

for i in range(len(nums)):
    ans = ans * nums[i]
    if(ans > 1000000000000000000):
        print((-1))
        quit()
print(ans)
# Original solution

n = int(eval(input()))
A = list(map(int,input().split()))
product = 1

for x in range(n):
    product = product*A[x]

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

# Optimized solution
import sys

n = int(eval(input()))
A = list(map(int,input().split()))
product = 1

if 0 in A:
    print((0))
    sys.exit()
else:
    for x in range(n):
        product = product*A[x]
        if product > 10**18:
            print((-1))
            sys.exit()

print(product)
# Original solution
from functools import reduce
from decimal import *
from operator import mul

def main():
    max_n = 10**18
    n = int(eval(input()))
    a = input_list()
    if 0 in a:
        print((0))
        exit()
    ans = reduce(mul, a)
    if ans > max_n:
        print((-1))
    else:
        print(ans)

def input_list():
    return list(map(int, input().split()))


if __name__ == '__main__':
    main()


# Optimized solution
#import numpy
import math
import sys

def main():
    n = int(eval(input()))
    a = sorted(input_list())
    max_n = 10 ** 18
    ans = 1
    for v in a:
        ans *= v
        if ans > max_n:
            ans = -1
            break
        if ans == 0:
            break
    print(ans)


def yogen(a, b, angle):
    coss = math.cos((angle/180)*math.pi)
    return math.sqrt(a**2 + b**2 - 2*a*b*coss)


def get_angle(hour, minute):
    h = (hour * 360) / 12 + (minute * 360) / (12 * 60)
    m = (minute * 360) / 60
    angle = abs(h-m)
    return min(angle, 360-angle)

def has(v, l):
    for vl in l:
        if v == vl:
            return True
    return False

def input_list():
    return list(map(int, sys.stdin.readline().split()))


if __name__ == '__main__':
    main()
# Original solution
from functools import reduce
n = int(eval(input()))
A = list(map(int,input().split()))
S = reduce(lambda x, y: x * y, A)
if S > 10**18:
    print((-1))
else:
    print(S)

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

# Optimized solution
#!/usr/bin/env python3
import sys
n=int(eval(input()))
a=list(map(int,input().split()))
ans=1
 
for i in range(n):
    if a[i]==0:
        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()))
n_list = [int(i) for i in input().split()]
ans = 1
n_list.sort()
for i in n_list:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
print(ans)


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


if res > 10**18:
    print((-1))
else:
    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 a[i] == 0:
            break
        if res > 10**18:
            print((-1))
            break


    if res > 10**18:
        pass
    else:
        print(res)
# Original solution
def main():
    n = int(eval(input()))
    ary = [int(i) for i in input().split()]
    ary = sorted(ary)

    from math import log2
    lt = log2(10**18)

    if ary[0] == 0:
        print((0))
        return
      
    if any(log2(ary[i]) > lt / (n-i) for i in range(n)):
        print('-1')

    else:
        prod = 1
        for i in range(n):
            prod *= ary[i]
        if prod > 10**18:
            print((-1))
        else:
            print(prod)

main()


# Optimized solution
def main():
    n = int(eval(input()))
    ary = [int(i) for i in input().split()]
    ary = sorted(ary)

    if ary[0] == 0:
        print((0))
        return

    prod = 1
    for i in reversed(list(range(n))):
        prod *= ary[i]
        if prod > 1000000000000000000:
            print((-1))
            return

    print(prod)
main()
# Original solution
import sys

n = int(eval(input()))
l = []
l += list(map(int, input().split()))

r = 1
for e in l:
    r = r * e

if r > 10 **18:
    print('-1')
    sys.exit()
        
print(r)

# Optimized solution
import sys

n = int(eval(input()))
l = []
l += list(map(int, input().split()))

if l.count(0) >= 1:
    print('0')
    sys.exit()

r = 1
for e in l:
    r = r * e

    if r > 10 **18:
        print('-1')
        sys.exit()
        
print(r)
# Original solution
n = int(eval(input()))
ans = 1
limit = 10**18
for x in input().split():
    x = int(x)
    ans *= x
    if(x==0):
        print(x)
        exit()


if(ans > limit):
        print((-1))
        exit()    
print(ans)


# Optimized solution
n = int(eval(input()))
ans = 1
l = [int(x) for x in input().split()]
limit = 10**18
if(0 in l):
    print((0))
    exit()

for x in l:
    x = int(x)
    ans *= x

    if(ans > limit):
        print((-1))
        exit()    

print(ans)
# Original solution
N = int(eval(input()))
s = list(map(int,input().split()))
a = s[0]

if len(s) > 1:
    for i in range(1,N):
        if s[i] == 0:
            a=0
            break
        a = a * s[i]
        
if a > 10**18:
    a = -1
print(a)

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

if not 0 in s:
    if len(s) > 1:
        for i in range(1,N):
            a = a * s[i]
            
            if a > 10**18:
                a = -1
                break
else:
    a=0
print(a)
# 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()))

ans = 1
if (0 in a):
    print((0))
    exit()

for i in a:
    ans*=i
    if ans > 1e18:
        break

if ans > 1e18:
    print((-1))
else:
    print(ans)
# Original solution
import sys

n = int(eval(input()))
list_input = list(map(int, sys.stdin.readline().strip().split()))

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

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


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


# Optimized solution
import sys

n = int(eval(input()))
list_input = list(map(int, sys.stdin.readline().strip().split()))

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

a = 1
for i in list_input:
    a *= i
    if a > pow(10, 18):
        break


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

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

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

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

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

print(ANS)

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

A.sort()
if A[0] == 0:
    ANS = 0
else:
    A.sort(reverse=True)
    ANS = 1
    for a in A:
        ANS = ANS * a
        if ANS > 10 ** 18:
            ANS = -1
            break

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


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

print(ans)

# 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(map(int,input().split()))
ans = 1
for i in range(n):
    b = a.pop()
    ans *= b

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


# Optimized solution
N = int(eval(input()))
ans = 1
A = [int(i) for i in input().split()]
ans = 1
for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
if 0 in A:
    ans = 0
print(ans)
# Original solution
import sys
n = int(eval(input())) 

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

ans = 1;
for i in range(n):
  if a[i] == 0:
    print((0))
    sys.exit()
    
  ans *= a[i]
  
if (ans > 1000000000000000000):
    print((-1))
    sys.exit()
print(ans)

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

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

ans = 1;
for i in range(n):
  if (a[i] == 0):
    print('0')
    sys.exit()
 
for i in range(n):
    
  ans *= a[i]
  if (ans > 1000000000000000000):
    print('-1')
    sys.exit()
  

print(ans)
# Original solution
from functools import reduce

n = int(eval(input()))

a = list(map(int,input().split()))
new = reduce(lambda x, y: x*y, a)
val = pow(10,18)
if new > val:
	print((-1))
else:
	print(new)	 


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

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

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

# Optimized solution
n= int(eval(input()))
line= input().split(' ')
 
tot=1

for a in line:
	if a=='0':
		tot=0
		break

if tot==1:
	for a in line:
		tot*= int(a)
		if tot>10**18:
			tot=-1
			break

print(tot)
# 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')
else:
    print(ans) 


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

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


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

ans = 1
ng = False
max = 10**18
for A in Aj:
	if A == 0:
		ans = 0
		break
	if ng or ans*A > max:
		ans = -1
		ng = True
	else:
		ans *= A
print(ans)
# Original solution
n=int(eval(input()))
a = list(map(int, input().split()))
ans=1
b=10**18
for i in a:
    ans*=i
    if ans == 0:
        break
    if ans > b:
        ans=-1
print(ans)

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

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

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

ans = li[0]
for i,l in enumerate(li):
    if i == 0:
        continue
    else:
        #print(l,'l')
        ans *= l
        if ans > 10**18:
            print((-1))
            exit()
        #print(ans)
if ans > 10**18:
    print((-1))
else:
    print(ans)
# Original solution
n = int(eval(input()))
li = list(map(int,input().split()))
ans = 1

for i in li:
    ans *= i

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

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

n = int(eval(input()))
li = list(map(int,input().split()))
ans = 1

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

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

print(ans)