peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())

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

limit = int(1e18)

answer = 1

over = False

for a in a_i:
    answer *= a
    if answer > limit:
        over = True
        break

if min(a_i) == 0:
    over = False
    answer = 0

if over:
    print(-1)
else:
    print(answer)
n = int(input())
datas = input().split(' ')
datas = [int(x) for x in datas if x != '1']

if 0 in datas:
    print(0)
else:
    sums = 1
    for data in datas:
        d = int(data)
        sums *= d
        if sums > 1000000000000000000:
            sums = -1
            break
    print(sums)
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            break
    else:
        print(ans)
n = int(input())
a_str = input().split()
a = [int(x) for x in a_str]
prod = 1
flag = 1
for i in range(n):
    if a[i] == 0:
        print(0)
        flag = 0
if flag == 1:
    for i in range(n):
        prod *= a[i]
        if prod > 10**18:
            print(-1)
            flag = 0
            break
if flag == 1:
    print(prod)
def main():
    N = int(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()
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans=1
upper_limit = int(1e18)
if A[-1]==0:
  print(0)
  exit()
else:
  for i in range(N):
    ans*=A[i]
    if ans > upper_limit:
      print(-1)
      exit()
print(ans)
n = int(input())
A = list(input().split())


def f():

    for i in range(n):
        a = int(A[i])
        if(a == 0):
            return 0

    ans = 1

    for i in range(n):
        a = int(A[i])
        if(a == 0):
            return 0
        elif(ans*a > 1000000000000000000):

            return -1
        ans *= a

    return ans


print(f())
_ = 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)
n=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)
N = int(input())
A = list(map(int, input().split()))

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

print(ans)
N = input()
A = list(map(int, input().split()))
A.sort()
ans = 1
for i in A:

    ans = ans * i
    if ans == 0:
        break
    if ans > 1000000000000000000:
        ans = -1
        break

print(ans)
import sys
n=input()
n=int(n)
a=input().split()
ans=1
v=[]
for m in a:
    m=int(m)
    if(m==0):
        print(0)
        sys.exit()
    else:
        v.append(m)
for m in v:
    if(ans>1e18):
        print(-1)
        sys.exit()
    else:
        ans*=m
if(ans>1e18):
    print(-1)
else :
    print(ans)
#import functools
a = 10**18
N = int(input())
A = list(map(int , input().split()))
if 0 in A:
    ans = 0
else:
    ans = 1
for i in A:
    ans *= i
    if ans > a:
        ans = -1
        break
print(ans)
import sys
n = int(input())
nun_list = list(map(int, input().split()))
result = 0
if nun_list.__contains__(0):
    print(0)
    sys.exit()

for i in range(n):
    if i == 0:
        result = nun_list[i]
    else:
        result = result * nun_list[i]
    if result > 10**18:
        print('-1')
        sys.exit()
print(result)
a=int(input())
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
    for x in A:
      ans*=x
      if ans>10**18:
        break


    if ans>10**18:
      print(-1)
    else:
      print(ans)
else:
  print(0)
n=int(input())
a=list(map(int,input().split()))

x=a[0]

if 0 not in a:
    for i in range (1,n):
        x=x*a[i]
        if x > pow(10,18):
            print(-1)
            exit()           
    print(x)         
else:
    print(0)
n = int(input())
li = map(int,input().split())
ans=1
mx=10**18
for i in li:
    ans*=i
    if ans>mx:
        ans=-1
        break
for i in li:
    if i==0:
        ans=0
        break
print(ans)
import sys

N = int(input())
A = list(map(int, input().split()))
result = A[0]

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

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

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

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

print(ans)
n = int(input())
A = list(map(int, input().split()))
ans = 1

for i in range(n):
    if A[i] == 0:
        ans = 0


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

    if ans > 1e18:
        ans = -1
        break


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

p = 1
limit = 10 ** 18
for a in A:
    if a == 0:
        print(0)
        exit()
    p *= a
    if p > limit:
        print(-1)
        exit()
print(p)
# -*- coding: utf-8 -*-
import sys

N, *A = map(int, sys.stdin.buffer.read().split())

answer = 1
for a in A:
  answer *= a
  if answer>10**18 or answer<0:
    answer = -1

print(answer)
from sys import stdin, stdout 
def main(): 
	n = stdin.readline() 
	arr = [int(x) for x in stdin.readline().split()] 
	ok = 0
	pro = 1 
	INF = 1e18
	for x in arr:
		if(x == 0):
			ok = 1
	if(ok==1):
		return 0 
	else:
		for x in arr:
			pro = pro*x ;
			if(pro > INF):
				return -1
	return pro
# call the main method 
if __name__ == "__main__": 
	ans = main()
	stdout.write(str(ans))
n = int(input())
a = list(map(int, input().split()))
a_s = sorted(a)
b = 1
for i in range(n):
    b = b * a_s[i]
    if b > 10**18:
        b = -1
        break
    elif b == 0:
        break

print(b)
def main():
    N = int(input())
    A = list(map(int,input().split()))
    
    if 0 in A:
        return print(0)
    prod = 1
    for n in A:
        prod *= n
        if prod > 1000000000000000000:
            return print(-1)
    return print(prod)

main()
N = int(input())
AS = [int(x) for x in input().split()]
result = 1
for x in AS:
    if x == 0:
        result = 0
        break
    if result == -1:
        continue
    result *= x
    if result > 10 ** 18:
        result = -1

print(result)
import numpy as np
N = int(input())
list = list(map(int,input().split()))
ans = np.prod(list)
if ans > 10**18 or ans == 0:
  ans = -1
if 0 in list:
  ans = 0
print(ans)
import sys
n=int(input())
A = [int(x) for x in input().split()]
bar = 10**18
ans =A[0]
if 0 in A:
    print(0)
    sys.exit()
    
for i in A[1:]:
    ans = ans * i
    if ans > bar:
        print(-1)
        sys.exit()
        
print(ans)
n=int(input())
a=list(map(int,input().split()))
ans=1
zero=0
for i in range(n):
    if (ans!=-1): ans*=a[i]
    if (ans>pow(10,18)): ans=-1
    if (a[i]==0): zero=1
if (zero==0): print(ans)
else: print(0)
n = int(input())
l= list(map(int,input().split()))
if 0 in l:
  print(0)
  exit()
ans = 1
for i in l:
  ans *= i
  if ans > 10**18:
    print(-1)
    exit()
print(ans)
n = int(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:
        ans = -1
        break
print(ans)
n=int(input())
a=[int(x) for x in input().split()]
if 0 in a:
    print(0)
else:
    s=1
    for c in range(n):
        s=s*a[c]
        if s>10**18:
            s=-1
            break
    print(s)
n = int(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)
n=int(input())
a = list(map(int,input().split()))

for i in a:
      if i==0:
            print('0')
            exit()

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

print(ans)
N = int(input())
A = list(map(int, input().split()))
if min(A) == 0:
  ans = 0
  print(ans)
  quit()

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

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

res = 1
flag = True
if 0 in A:
    print(0)
else:
    for i in range(len(A)):
        res = res * A[i]
        if res > mod:
            flag = False
            break
    if flag:
        print(res)
    else:
        print(-1)
n = int(input())
a = list(map(int, input().split()))
p = 1
if 0 in a:
    print(0)
else:
    for i in a:
        p *= i
        if p > 10**18:
            print(-1)
            break
    if p <= 10 ** 18: print(p)
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  
  #0条件
  if 0 in A:
    print(0)
    exit()
  
  ans = 1
  for a in A:
    #積
    ans *= a
    
    #条件
    if ans > 10**18:
      print(-1)
      exit()
  print(ans)

main ()
import sys
N = int(input())
A = list(map(int, input().split()))

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

limit = 10 ** 18
ans = A[0]
for i in range(1,N):
    ans = ans * A[i]
    if ans > limit:
        print("-1")
        sys.exit()

print(ans)
n=int(input())
import  functools
import operator
prod=functools.partial(functools.reduce, operator.mul)
a=list(map(int,input().split()))
a.sort(reverse=True)
if a[0]*a[1]>10**18 and a[-1]!=0:
    print(-1)
    exit()
if a[-1]==0:
    print(0)
    exit()
    
ans=prod(a)

if ans>10**18:
    print(-1)
else:
    print(ans)
N = int(input())
a = list(map(int, input().split()))

ans = 1
if 0 in a:
    print(0)
else:
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            print(-1)
            exit()

    print(ans)
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse = False)
cnt = 1


if 0 in A:
    print (0)
    exit()
else:
    for i in range(N):
        cnt *= A[i]
        if cnt > 10 ** 18:
            print (-1)
            exit ()
print (cnt)
n = int(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)
n = int(input())
l = [int(x) for x in input().split()]
counter_1 = 0
counter_2 = 0
a = 1
for i in range(n):
  if l[i] == 0:
    counter_1 += 1
    print(0)
    break
if counter_1 == 0:
  for i in range(n):
    if counter_2 == 1:
      break
    else:
      a = a * l[i]
      if a > 10 ** 18:
        counter_2 +=1
        print(-1)
  if counter_2 == 0:
    print(a)
from math import log10
from functools import reduce
from operator import mul

N = int(input())

nums = [int(s) for s in input().rstrip().split()]

def product(nums):
  limit = 10**18
  result = 1
  if 0 in nums:
    return 0
  for n in nums:
    result *= n
    if result > limit:
      return -1
  return result
    
print(product(nums))
N = int(input())
lst = list(map(int, input().split()))
if 0 in lst:
  print(0)
else:
  ans = 1
  for i in lst:
    ans *= i
    if ans > 1000000000000000000:
      print(-1)
      ans = -1
      break
  if ans != -1:
    print(ans)
N = int(input())
A = list(map(int,input().split()))

A = sorted(A, reverse= True)

if A[-1] == 0:
    print(0)
    exit()
    
ans = 1

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

print(ans)
import sys
n = int(input())
a = list(map(int, input().split()))
if a.count(0) > 0:
    print(0)
    sys.exit()
b = 1
for i in range(n):
    b*=a[i]
    if b > 10**18:
        print("-1")
        sys.exit()
print(b)
def main():
  N = int(input())
  A = list(map(int, input().split()))

  if 0 in A:
    print(0)
    return
  
  num = 1
  max_num = 10**18
  for i in A:
    num *= i
    
    if num > max_num:
      print(-1)
      return
  
  print(num)
  
main()
n = input()
a = list(map(int,input().split()))
a.sort()
ans=1

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

print(ans)
N = int(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)
import sys
n = int(input())
a = [int(i) for i in 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)
def main():
    N = input()
    listCulcNum = list(map(int, input().split()))

    answer = 1
    maxNum = 10 ** 18

    if(0 in listCulcNum):
        print(0)
        return

    for culcNum in listCulcNum:
        answer = answer * culcNum

        if(answer > maxNum):
            answer = -1
            break

    print(answer)

if __name__ == "__main__":
    main()
n= int(input())
l =list(map(int,input().split()))
ans= 1

if 0 in l:
    print("0")
else:
    for i in range(n):
        ans*= l[i]
        if ans> 10**18:
            break
    if ans> 10**18:
        print("-1")
    else:
        print(ans)
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())

"""========main code==============="""
t=ii()

a=ll()
s=1
f=0
val=10**18
if 0 in a:
    print(0)
else:    
    for i in a:
        s*=i
        if(s>val):
            f=1
            break
    if f:
        print(-1)
    else:
        print(s)
n=int(input())
#a,b=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

thre=10**18

if al.count(0)>=1:
    ans=0
else:
    ans=al[0]
    for i in range(1,n):
        ans=ans*al[i]
        if ans >thre:
            ans=-1
            break
print(ans)
def solve():
    _ = int(input())
    a = list(map(int, input().split()))
    res = 1
    for x in a:
        if x == 0:
            print(0)
            return
    for x in a:
        res *= x
        if res > int(1e18):
            print(-1)
            return
    print(res)


solve()
N = input()
As = list(map(int, input().split()))
if 0 in As:
    print(0)
else:
    ans = 1
    for a in As:
        ans *= a
        if ans > 10**18:
            ans = -1
            break

    print(ans)
n=int(input())
a=sorted(map(int,input().split()))
ans = 1

for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        ans = -1
        break
print(ans)
n = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
else:
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            ans = -1
            break
    print(ans)
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
lim = 10**18

ans = 1
for i in A:
    ans *= i
    if ans > lim:
        print(-1)
        exit()

else:
    if ans >10**18:
        print(-1)
    else:
        print(ans)
n=int(input())
a=sorted(list(map(int,input().split())))
s=a[0]
for i in range(1,n):
    s*=a[i]
    if s>10**18:
        print(-1)
        exit()
print(s)
n = int(input())
a = list(map(int,input().split()))
ans = 1
a = sorted(a)
for i in a:
  if ans > 10**18:
    ans = -1
    break
  else:
    ans *= i

if ans >10**18:
  print(-1)
else:
  print(ans)
import numpy as np

N=int(input())
A=np.ones(N)
a=np.ones(N)

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


a=sorted(A,reverse=True)

a_product=1
flag_1e18=False
flag_0=False

if a[N-1]==0:
  flag_0=True

for i in range(0,N,1):
  a_product=a_product*a[i]
  if a_product>1e18:
    flag_1e18=True
    break
  else:
    continue
    
if flag_1e18==True and flag_0==False:
  print(-1)
elif flag_0==True:
  print(0)
else:
  print(a_product)
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
prod=1
for i in a:
    prod*=i
    if prod>10**18:
        break
if prod>10**18:
    print(-1)
else:
    print(prod)
N=int(input())
A=list(map(int,input().split()))

A.sort()
ans=1
maximum=10**18
for a in A:
  if a==0:
    print(0);exit()
  ans*=a
  if ans>maximum:
    print(-1);exit()
print(ans)
# your code goes here
def solve():
	n = int(input())
	a = input().split()
	a = [int(aa) for aa in a]
	
	for aa in a:
		if aa == 0:
			print(0)
			return 0
	
	ans = 1;
	for aa in a:
		ans *= aa;
		if ans > 1e18:
			print(-1)
			return 0
	print(ans)
	
solve()
n = int(input())
vs = list(map(int, input().split()))

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

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

print(total)
n = int(input())
a = [int(x) for x in input().split()]

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

ans = 1

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


if ans > 10**18:
    print(-1)
else:
    print(ans)
def main():
    N = int(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()
import sys
input = sys.stdin.readline

n = int(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)
N = int(input())
*A, = map(int, input().split())

list.sort(A, reverse=True)
mx = 10 ** 18
mul = 1

if 0 in A:
    print(0)
    exit(0)
    
for a in A:
    mul *= a
    if mul > mx:
        mul = -1
        break

print(mul)
N = int(input())
Alist = list(map(int, input().split()))
ans = 1
if 0 in Alist:
    print(0)
    exit()
for a in Alist:
    ans *= a
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)
n = int(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)
def main():
    from sys import stdin
    input = stdin.readline
    n = int(input())
    inlis = list(map(int, input().split()))
    if 0 in inlis:
        ans = 0
    else:
        ans = 1
        for i in inlis:
            ans *= i
            #print(ans)
            if ans > 10 ** 18:
                ans = -1
                break
    print(ans)
    
 
 
 
if __name__ == "__main__":
    main()
N = int(input())
num_list = list(map(int, input().split()))

ans = 1

if 0 in num_list:
    print(0)
else:
    for i in num_list:
        ans *= i
        if ans > 10**18:
            print('-1')
            break

    if ans<= 10**18:
        print(ans)
if __name__ == '__main__':

	INF = 10**18
	
	n = int(input())
	A = list(map(int,input().split()))

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

	ans = 1
	flg = False

	for i in range(n):
		ans = ans * A[i]
		if ans > INF:
			ans = -1
			break

	print(ans)
import sys
n=int(input())
a=[int(x) for x in input().split()]

inf=10**18
ans=1
if 0 in a:
    print(0)
    sys.exit()


for x in a:
    ans*=x
    if ans>inf:
        print(-1)
        sys.exit()
print(ans)
N = int(input())

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

flag = 0
ans = 1

if 0 in A:
    print(0)
    flag = 1

for i in range(N):
    if flag == 1:
        break
    ans = ans * A[i]
    if ans > 1000000000000000000 :
        print('-1')
        flag = 1
        break
if flag == 0:
    print(ans)
N = int(input())
A = list(map(int,input().split()))
A.sort()
result = 1
for i in range(N):
    result = result * A[i]
    if result > 1e18:
        result = -1
        break
print(result)
import sys

N = int(input())
A = [int(x) for x in input().split(" ")]
if 0 in set(A):
    print(0)
    sys.exit(0)

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


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

max_val = 10 ** 18

val = 1

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

for item in a:
    val *= item
    if val > max_val:
        print(-1)
        exit()

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

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

answer = 1
for Ai in A:
    answer *= Ai
    if answer > 10 ** 18:
        answer = -1
        break

print(answer)
input_number = int(input())
int_list = list(map(int, input().split()))

check = 10 ** 18
ans = int_list[0]
for i in int_list[1:]:
    ans = ans * i

    if ans > check:
        ans = -1
        break

for i in int_list:
    if i == 0:
        ans = 0
        break

print(ans)
N = int(input())
A = [int(x) for x in input().split()]

reg = A[0]
flg=True
if 0 in A:
    print(0)
    flg=False
    reg=0
for i in range(1, N):
    reg *= A[i]
    if reg>10**18:
        print(-1)
        flg=False
        break
if flg:
    print(reg)
import math
from collections import deque
from collections import defaultdict


#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))


n = readInt()
a = readInts()

ans = 1

d = defaultdict(int)

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

for i in a:
	d[i]+=1

for k in d:
	ans*=k**d[k]
	if ans>10**18:
		print(-1)
		exit()

else:
	print(ans)
import numpy as np
a=int(input())
b=list(map(int,input().split()))
c=1
if 0 in b:
    print(0)
    exit()
else:
    for i in range(a):
        c=c*b[i]
        if c>10**18:
            print(-1)
            exit()
        else:
            continue
print(c)
N = int(input())
A = list(map(int, input().split()))

product = 1
flag = 0

if 0 in A:
    print(0)
else:
    for i in range(N):
        product *= A[i]
        if product > 1000000000000000000:
            flag += 1
            break
    if flag == 0:
        print(product)
    else:
        print(-1)
N = int(input())
A = list(map(int, input().split()))

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

if 0 in A:
  print(0)
else:
  print(ans)
def main():
    N = int(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()
import sys

n = int(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)
N=int(input())
A=[int(x) for x in input().split()]
ans=1
if 0 in A:
    ans=0
else:
    for i in range(0,N):
        ans=ans*A[i]
        if ans>1000000000000000000:
            ans=-1
            break
print(ans)
import sys

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

total = 1
a_sort = sorted(a)
if a_sort[0] == 0:
    print("0")
    sys.exit()

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

print(total)
n=int(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)
import sys
#import time
import copy
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**20
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n = ri()
a = rl()
ans=1
flag=False
for i in a:
    ans*=i
    if ans>10**18:
        flag=True
        break
   
zero=False
for i in a:
    if i==0:
        zero=True
        break
if zero:
    print(0)    
elif flag:
    print(-1)
else:
    print(ans)