peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
a=int(input())
b=list(map(int,input().split()))
c=b.count(0)
if c>0:
    print('0')
    sys.exit()
ans=1
for i in range(a):
  ans=ans*b[i-1]
  if ans>10**18:
      print('-1')
      sys.exit()
      
print(ans)
n = int(input())
A = list(map(int,input().split()))
A.sort()
if A[0]==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()))
x=10**18
ans=1
for num in a:
    ans*=num
    if ans>x:
        ans=-1
        break
if 0 in a:
    ans=0   
print(ans)
N = int(input())
#A = list(reversed(sorted(list(map(int, input().split())))))
A = sorted(list(map(int, input().split())))
assert len(A) == N
mul = 1
for a in A:
  mul *= a
#  print(a, mul)
  if a == 0:
    print(0)
    break
  if mul > (10 ** 18):
    print(-1)
    break
else:
  print(mul)
n = int(input())
arr = list(map(int,input().split()))
ans = 1
if 0 in arr:
    print(0)
    exit()
for i in arr:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
print(ans if ans <= 10**18 else -1)
n=int(input())
multi3 = [int(x.strip()) for x in input().split()]
ans=1
flag=True
for i in multi3:
    if ans*i>10**18:
        flag=False
    elif i==0:
        flag=True
        ans=0
        break
    else:
        ans*=i
if(flag):
    print(ans)
else:
    print(-1)
import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

def main():
    N = int(input())
    A = list(map(int, input().split()))
    for i in range(N):
        if A[i] == 0:
            print(0)
            return
    
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans > 10**18:
            print(-1)
            return
    print(ans)
    

if __name__ == "__main__":
    main()
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

work = 1
exceeded = False
for i in a:
    work *= i
    if work > 1000000000000000000:
        exceeded = True
        break

if work > 1000000000000000000:
    exceeded = True

if exceeded:
    print(-1)
else:
    print(work)
import sys

# print('input >>')
N = int(input())
As = list(map(int,(input().split())))

INF = 10 ** 18

ans = 1

over = False

for A in As:
    if A == 0:
        print(0)
        sys.exit()

for A in As:
    ans *= A
    if ans > INF:
        print(-1)
        sys.exit()
        
# print('-----output-----')
print(ans)
n = int(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)
n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            break
    else:
        print(ans)
big = 10**18
n = int(input())
things = list(map(int, input().split()))
result = 1
good = True
if 0 in things:
	print(0)
else:
	for x in things:
		result *= x
		if result > big:
			print(-1)
			good = False
			break
	if good:
		print(result)
n = int(input())
m = 1000000000000000000
num_list = [ int(v) for v in input().split() ]
ans = 1
s = 0
if 0 in num_list:
	ans = 0
for i in num_list:
	ans *= i
	if ans > m:
		s = 1
		break
if s == 0:
	print(ans)
else:
  	print(-1)
def main():
    n = int(input())
    a = list(map(int, input().split()))

    if 0 in a:
        print(0)
        return

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

    print(res)

main()
n, *a = map(int, open(0).read().split())
res = 1
if 0 in a:
  print(0)
  exit()
for a in a:
  res *= a
  if res > 1e18:
    res = -1
    break
print(res)
n = int(input())
s = input().split()
s = [int(i) for i in s]
mul = 1
flag = 0

if 0 in s:
    print(0)
else:


    for item in s:
        mul *= item
        if flag == 1:
            break

        if mul >  1e18:
            print(-1)
            flag = 1

    if mul <=  1e18:
        print(mul)
def resolve():
	N = int(input())
	A = [int(i) for i in input().split()]
	if 0 in A:
		print(0); return
	A.sort()
	ans = 1
	for i in reversed(range(N)):
		ans *= A[i]
		if ans > 10**18:
			print(-1); return
	print(ans)

resolve()
N = int(input())
A = list(map(int, input().split()))
num = 1
A.sort()
for i in range(N):
    num *= A[i]
    if num > 10 ** 18:
        num = -1
        break
print(num)
import sys

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

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

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

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()
if __name__ == "__main__":
    N = int(input())
    num_list = list(map(int, input().split()))
    ans = 1
    MAX = 1e18
    for i in num_list:
        ans = ans*i
        if ans > MAX:
            ans = -1
            break
    if 0 in num_list:
        print(0)
    else:
        print(ans)
n = int(input())

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

ans = 1

for b in a:
    if b == 0:
        ans = 0
        break
    else:
        ans *= b
        if ans > pow(10, 18):
            ans = -1
            break

print(ans)
n = int(input())
a=list(map(int,input().split()))
if 0 in a:
    result=0
else:
    result = 1
    for i in range(n):
        result *= a[i]
        if result>1000000000000000000:
            result = -1
            break
print(result)
N = int(input())
A = list(map(int, input().split()))
A.sort()
answer = 1

for i in A:
    answer = answer * i
    if i == 0:
        print(0)
        break
    if answer > 10 **18:
        print(-1)
        break
else:
        print(answer)
import sys
n = int(input())
numlist = list(map(int, input().split()))
if 0 in numlist:
    print(0)
else:
    ans = 1
    for i in numlist:
        ans *= i
        if ans > 10**18:
            print("-1")
            sys.exit()
    print(ans)
n= int(input())
a= list(map(int,input().split()))
ans=1
a.sort()
for i in a:
    ans=ans* i
    if i==0:
        break
    if ans>10**18:
        break

if ans > 10**18:
    print("-1")
else:
   print(ans)
if __name__ == "__main__":
    N = int(input())
    A = sorted(list(map(int, input().split())))
    ans = 1
    for i in range(N):
        ans *= A[i]
        if ans > 10**18:
            print(-1)
            break
    else:
        print(ans)
N = int(input())
A = list(map(int, input().split()))

R=1
if 0 in A:
    print("0")
else:
    for i in range(0, N):
        R=R*A[i]
        if R>1000000000000000000:
            print("-1")
            exit()
        
    print(R)
n = int(input())
ln =list(map(int, input().split()))
a = 1

for i in sorted(ln):
    if a > 10**18 or a == 0:
        break
    else:
        a = a*i
        
    
    
if a> 10**18:
    print('-1')
else :
    print(a)
# coding: utf-8
# Your code here!

n = int(input())
num_list = list(map(int, input().split()))
sum=1

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

for i in num_list:
    
    if i==0:
        print(0)
        exit()
    i=str(i)
    sum=str(sum)
    
    if len(i)+len(sum)>21:
        print(-1)
        exit()
    i=int(i)
    sum=int(sum)
    sum=sum*i
    if sum>10**18:
        print(-1)
        exit()
print(sum)
N=int(input())
As = list(map(int,input().split()))

MAX=10**18
ans = 1
fover=False
fzero=False
for A in As:
    if A==0:
        fzero=True
        break
    if not fover:
        ans *= A
        if ans > MAX:
            fover=True

if fzero:
    print(0)
elif fover:
    print(-1)
else:
    print(ans)
import math
import sys
import collections
from collections import defaultdict
from sys import stdin, stdout

sys.setrecursionlimit(10**9)
n=int(input())
arr=list(map(int,input().split()))
mult=1
flag=0
if 0 in arr:
    print(0)
else:
    for i in range(n):
        mult*=arr[i]
        if mult>10**18:
            flag=1
            break

    if flag==0:
        print(mult)
    else:
        print(-1)
n = int(input())
a = list(map(int, input().split()))

ans = 1

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

print(ans)
import math
def main():
    i = int(input())
    j = list(map(int, input().split()))
    res = 1

    if 0 in j:
        print(0)
        return

    for jj in j:
        res *= jj
        if math.pow(10, 18) < res:
            print(-1)
            return

    print(res)


if __name__ == "__main__":
    main()
n=int(input(''))
s=input('')
s=s.split(' ')
p=1
f=0
t=0

for a in range(n):
    s[a]=int(s[a])

for b in s:
    if b==0:
        t=1

if t==1:
    print(0)
else:
    for a in range(n):
        p=p*s[a]

        if p>10**18:
            f=1
            break


    if f==1:
        print(-1)
    else:
        print(p)
N = int(input())
A = list(map(int, input().split()))
ans =1;
iszero = False

if 0 in A:
  iszero = True
for i in range(N):
  if(iszero):
    ans = 0
    break
  ans *= A[i] 
  if ans>10**18:
    ans = -1
    break

print(ans)
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n= ii()
a= li()

ans=1
a.sort()
a.reverse()

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

for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
    elif a[i] == 0:
        print(0)
        exit()
print(ans)
N = input()
listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10**18:
      mul = -1
print(mul)
def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    for x in a:
        if x==0:
            print(0)
            return

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

    print(ans)

solve()
n=int(input())
l = list(map(int,input().split()))
s=1
if 0 in l:
    print(0)
else:
    for i in l:
        s*=i
        if s>10**18:
            s=-1
            break
    print(s)
n = int(input())
a = list(map(int,input().split(" ")))

r = 1

for x in a:
    if(x == 0):
        print(0)
        exit(0)    

for x in a:
    r = r * x
    if(r > 10**18):
        print(-1)
        exit(0)
r = int(r)
print(r)
n = int(input())
num = list(map(int, input().split()))

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

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

limit = 10 ** 18
res = A[0]

if 0 in A:
    print(0)
    exit(0)
else:
    for i in range(1, N):
        res *= A[i]
        if res > limit:
            print(-1)
            exit(0)

print(res)
N = int(input())
A = sorted(list(map(int,input().split())))
ans = A[0]
if ans == 0:
    print(ans)
    exit()
else:
    for i in range(1,N):
        ans = ans * A[i]
        if ans > 10**18:
            ans = -1
            break
    print(ans)
N = int(input())
*A, = map(int, input().split())
ans = 1
mx = 10**18
for a in A:
    if a == 0:
        print(0)
        exit()
for a in A:
    ans *= a
    if ans > mx:
        print(-1)
        exit()
print(ans)
n=int(input())
mul=1
limit=1000000000000000000
x=input().split()
for i in range (n):
    p=int(x[i])
    if(p==0):
        mul=0
        break
if(mul==0):
    print(mul)
else:
    for i in range (n):
        p=int(x[i])
        mul*=p
        if(mul>limit):
            break
    if(mul>limit):
      print(-1)
    else:
      print(mul)
N = int(input().rstrip())
A = sorted([int(v) for v in input().rstrip().split()])

r = 1
for v in A:
    if v == 0:
        r = 0
        break

    r *= v
    if r > 1000000000000000000:
        r = -1
        break

print(r)
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    a.sort()
    ans = 1
    for i in range(n):
        if a[i] == 0:
            print(0)
            sys.exit()
        ans *= a[i]
        if ans>10**18:
            print(-1)
            sys.exit()
    print(ans)
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*A = map(int, read().split())

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

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


if __name__ == "__main__":
    main()
n = int(input())
a = list(map(int, input().split()))
t = 1
if 0 in a:
    print("0", end="")
    exit()

for i in range(n):
    t = t*a[i]
    if t > 10**18:
        print("-1", end="")
        exit()
print(t, end="")
N = int(input())
arr = [int(x) for x in input().split()]
found = False
for x in arr:
  if x == 0:
    found = True
if found:
  print(0)
  exit(0)
res = 1
MAX = 10 ** 18
for x in arr:
  res *= x
  if res > MAX:
    print(-1)
    exit(0)
print(res)
N = int(input())
A = list(map(int, input().split()))

ans = 1
if A.count(0) >= 1:
    print(0)
    exit()
for i in A:
    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 range(n):
    ans *= a[i]
    if ans > 10**18:
        ans = -1
        break

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

if 0 in l:
    ans = 0
else:
    n = min(N,len(l))
    ans = 1
    for i in l[:n]:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
print(ans)
n=int(input())
p=list(map(int, input().split()))
i=0
ans=1
flag=0
k=1e18
while(n>i):
	if(p[i]==0):
		flag=1
	i+=1
if(flag==1):
	print(0)
else:
	flag=0
	i=0			
	while(n>i):
		ans*=p[i]
		if(ans>k):
			flag=1
			break
		i+=1		
	if( flag==1):
		print(-1)
	else:
		print(ans)
n=int(input())
l=list(map(int,input().split()))
p=1
flag=1
zero=0 
for i in l:
    if i==0 :
        zero=1 
        break 
if zero==0:
    for i in l:
        p*=i
        if p>1000000000000000000:
            flag=0
            break
    if flag==0:
        print('-1')
    else:
        print(p)
else : 
    print("0")
n = int(input())
a = list(map(int, input().split()))
sum = 1

for i in range(n):
    if a[i] == 0:
        print(0)
        exit(0)

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

print(sum)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()

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

if __name__ == '__main__':
    main()
N=int(input())
lis = list(map(int, input().split()))
ans=1
j=True
if lis.count(0) > 0:
    print(0)
else:
    for a in lis:
        ans*=a
        if ans > pow(10,18):
            j=False
            break
    if j:
        print(ans)
    else:
        print(-1)
# import numpy 
n = int(input())
a = list(map(int,input().split()))
re = 1
if 0 in a:
    print("0")
else:
    for i in a :
        re = re * i
        if re > 1000000000000000000:
            print("-1")
            quit()
    print(re)
n, *a = map(int, open(0).read().split())
ans = 1
for i in range(n):
    if ans == -1:
        if a[i] == 0:
            ans = 0
            break
    else:
        ans *= a[i]
        if ans > 10**18:
            ans = -1
print(ans)
N = int(input())
P=list(map(int,input().split()))

a=1
for i in range(N):
  if(P[i]==0):
    a=0
    break
if a!=0:
  for i in range(N):
    a*=P[i]
    if(a>1000000000000000000):
      a=-1
      break
print(a)
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()))
if 0 in a:
    print(0)
else:
    s=1
    for i in a:
        s=s*i
        if s>10**18:
            s=-1
            break
    print(s)
input();ans,a=1,[*map(int,input().split())]
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 = list(map(int, input().split()))
total = 1

if 0 in a:
  total = 0
else:
  for i in a:
    total *= i
    if total > 10 ** 18:
      total = -1
      break
print(total)
n = int(input())
y = list(map(int, input().split(" ")))
s = 1
hoge = False
for i in y:
    if i ==0:
        print(0)
        hoge = True

def f():
    s = 1
    for i in y:
        s *= i
        if s>10**18:
            print(-1)
            return
    print(s)
if not hoge:
    f()
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=1

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

    

if ans<=10**18:
    print(ans)
else:
    print(-1)
n = int(input())
A = sorted(list(map(int,input().split())))
ans = 1
for i in A:
    ans = ans*i
    if 10**18 < ans:
        print (-1)
        exit ()
print (ans)
N=int(input())
A=list(map(int,input().split()))
ans=1
limit=10**18
flag=True
for x in A:
  if x==0:
    flag=False
    ans=0
if flag:
  for x in A:
    ans=ans*x
    if ans > limit:
      ans=-1
      break
print(ans)
n = int(input())
num = [int(i) for i in input().split()]

cont=0
ans=1

for j in num:
    if j == 0: cont+=1

if cont > 0: print(0)
else:
    for i in num:
        ans=ans*i
        if ans>1e18:
            ans=-1
            break
    print(ans)
n = int(input())
res = 1
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in range(n):
        res *= a[i]
        if res > 10**18:
            print(-1)
            quit()
    print(res)
n = int(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)
import numpy as np

N = int(input())
Alist = list(map(int,input().split()))

#ans = np.prod(Alist)
Alist.sort()
ans = 1
for i in range(N):
  #print (Alist[i])
  ans*= Alist[i]
  if Alist[i]==0:
    break
  if ans >10**18:
    break

if ans >10**18:
  print(-1)
else:
  print(ans)
n=int(input())

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

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

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

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
#read = sys.stdin.buffer.read

def main():
    N = int(input())
    A = list(map(int, readline().split()))
    ans = 1
    if 0 in set(A):
        print(0)
        return
    for a in A:
        ans *= a
        if ans > pow(10,18):
            print(-1)
            return
    print(ans)


if __name__ == "__main__":
    main()
n = int(input())
a = [int(num) for num in input().split()]
ans = 1
if 0 in a:
    ans = 0
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)
    exit()
    
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = 1
    for i in range(N):
        if ans == -1 and A[i] != 0:
            continue
        ans *= A[i]
        if ans > 10**18:
            ans = -1
    print(ans)

if __name__ == "__main__":
    solve()
n = int(input())
a = list(map(int, input().split()))

INF = 10 ** 18
ans = 1
if any([n == 0 for n in a]):
    print(0)
    exit()

for n in a:
    ans *= n
    if ans > INF:
        ans = -1
        break
print(ans)
n=int(input())
l=sorted(list(map(int,input().split())))
s=1
d=1
for i in l:
    s=s*i
    if(s>10**18):
        print(-1)
        d=0
        break
if(d==1):
    print(s)
n = int(input())
arr = [int(x) for x in input().split()]

mxN = 10**18
if 0 in arr:
    print(0)
    exit()
    
mul = 1
for x in arr:
    mul*=x
    if mul > mxN:
        print(-1)
        exit()

print(mul)
n = int(input())
a = list(map(int,input().split()))
ans = 1
a.sort()
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        quit()
print(ans)
import sys
n = int(input())
a = list(map(int, input().split()))

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

ans = 1
for ai in a:
    ans = ans * ai
    if ans > 10 ** 18:
        print(-1)
        sys.exit()
print(ans)
a = int(input())
b = list(map(int,input().split()))
r=1
if 0 in b:
  r=0
else:  
  for i in b:
    r*=i
    if r>10**18:
      r=-1
      break
print(r)
import itertools
import copy
from collections import deque
import heapq
n = int(input())
a = list(map(int,input().split()))
a.sort()
a = a[::-1]
ans = 1
if a[-1] == 0:
    print(0)
    exit()
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.sort()
ans = 1
for i in a:
    ans *= i
    if ans > pow(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 range(len(A)):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
def sol():
    n = int(input())
    mul = 1
    arr = list(map(int, input().split()))
    arr.sort()
    for i in arr:
        mul*=i
        if(mul>10**18):
            print(-1)
            return
    print(mul)
sol()
def main():
    n = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        ans *= a
        if ans > 10 ** 18:
            print(-1)
            break
    else:
        print(ans)
if __name__ == '__main__':
    main()
def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split())) #横並びの場合
n = int(input())
a = intList()

#MAX_NUM = 1000000 * 1000000 * 1000000
MAX_NUM = 10**18

for i in range(n):
    if a[i] == 0:
        print(0)
        exit()

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

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

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

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

if 0 in A:
    print(0)
else:
    prod = 1
    for i in A:
        prod = prod * i
        if prod > 10 ** 18:
            print(-1)
            exit()
    print(prod)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    length = 1
    limit = 10 ** 18
    if 0 in A:
        print(0)
        return
    for i in range(N):
        length = length *  A[i]
        if length > limit:
            print('-1')
            return
    print(length)
    return
if __name__ == '__main__':
    main()
n = input()
li = list(map(int, input().split())) 

total = 1
li.sort()
for a in li:
    if a == 0:
        total = 0
        break
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
print(total)
n = int(input())
a = list(map(int, input().split()))
ans = 1
if min(a) == 0:
    print(0)
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            ans = 0
    print(ans if ans != 0 else -1)