peterverebics/CodeNet_Python_118 huggingface dataset:
N = input()
N = int(N)
A = input().split()

M = 10 ** 18
Y = 1
for i in range(N):
    X = A[i]
    X = int(X)
    Y = Y * X
    if Y > M:
        break

if Y > M:
    print(-1)
else:
    print(Y)
N = int(input())
a = [int(i) for i in input().split()]
A = 1
if 0 in a:
    A = 0
else: 
    for i in range(N-1):
        A = A * a[i]
        if A > 1000000000000000000:
            A = -1
        break
print(A)
n=int(input())
alis=list(map(int,input().split()))
p=alis[0]
inf=10e+18
for i in range(1,n):
  p*=alis[i]
  if len(str(p))>18:
    print(-1)
    exit()
print(p)
a = 1

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

if 0 in s :
    print(0)
else :
    for i in range(N) :
        if a>10E+17 :
            print(-1)
            break
        else :
            a = a*s[i]
    if a>10E+17 :
        print("-1")
    else :
        print(a)
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    GI()
    CEIL = 10 ** 18

    prod = 1
    for x in GIS():
        prod *= x
        if prod > CEIL:
            prod = -1
            break
    print(prod)

main()
n = int(input())
sn = list(map(int, input().split()))

p = 1
for i in sn:
  p *= i
  if p > 1000000000000000000:
    p = -1
    print(-1)
    break

if p != -1:
  print(p)
from sys import exit
N = int(input())
A = list(map(int,input().split()))
ans = 1
for i in A:
    ans *= i
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
n = int(input())
re = 1

list = [int(s) for s in input().split()]
  
for i in range(n):
    re *= list[i]
    
if(re >= 100000000000000100000):
    print("-1")
else:
    print(re)
N = int(input())
str_num = input().split()

num_list = []
for i in str_num:
  num_list.append(int(i))

num_list.sort(reverse=True)

ans = num_list[0]

LIMIT_NUM = 10**18

for i in range(1,N):
  ans *= num_list[i]
  if ans > LIMIT_NUM:
    break

if ans > LIMIT_NUM:
  print(-1)
else:
  print(ans)
input()
a=1
b=map(int,input().split())
for i in b:
  a*=i
  if a>10**18:
    a=-1
    break
print(a)
n = int(input())
lis = list(map(int, input().split()))
a = 1
for i in range(n):
    a = a * lis[i]
    if a > 1000000000000000000:
        a = -1
        break
print(a)
N = int(input())
An_all = input().split()
An = []
for i in range(N):
    An.append(int(An_all[i]))

mult = 1
for i in range(N):
    mult = mult * An[i]

if mult >= 10e18:
    print(-1)
else:
    print(mult)
import numpy as np

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

if a.count(0) > 0:
  print(0)
  exit()
  
temp = b.prod()

if temp > 10**18:
  print('-1')
  exit()

print(temp)
n = int(input())
arr = [int(x) for x in input().split()] 

mult = 1;

for x in arr:
	mult *= x;

if(mult < 1000000000000000001):
	print(x)
else:
	print("-1")
import numpy

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

B = numpy.prod(A)

if B >= 10**8:
    print(-1)
else:
    print(B)
num = int(input())
num_list = input().split(" ")
result = 1
con = num >= 2 and num <= 100000
if con == True and num == len(num_list):
    for i in num_list:
        if int(i) >= 0 and int(i) <= 10000000000000000:
            result = result * int(i)
        else:
            break
    if result > 1000000000000000000:
        print(-1)
    else:
        print(result)
else:
    print()
n = int(input())
a = map(int, input().split())
now = 1
if 0 in a:
    print("0")
    exit()
for one in a:
    now *= one
    if now > 1e18:
        print("-1")
        exit()

print(now)
n=int(input())
l=list(map(int,input().split()))
a=1
for i in range(n):
    a*=l[i]
if a>10**8:
    print(-1)
else:
    print(a)
n = int(input())
a = 1
for i in map(int, input().split()):
    a *= i
if a > 10**18:
    a = -1
print(-1)
_ = input()
N = [int(v) for v in input().split()]
s = 1
for n in N:
    s *= n
    if s > 10**18:
        break

print(s if s <= 10**18 else -1)
n = int(input())
ans = 1
x = 10 ** 18
a = list(map(int,input().split()))
for i in range(n):
    ans = ans * a[i]
    answer = ans 
    if (ans > x):
        print(-1)
    else:
        print(answer)
n = int(input())
a = list(map(int, input().split()))
count = 1
l = 0
for i in a:
  count *= i
  if count > 1000000000000000000:
    l = -1
    break
if l == 0:
  print(count)
else:
  print(-1)
n=int(input())
A=list(map(int,input().split()))
a=0
ans=1
if 0 in A:
    ans=0
else:
    for a in range(n):
        ans*=A[a]
        a+=1
        if ans<=10**18:
            continue
        else:
            break
print(ans)
N = int(input())
l = [int(n) for n in input().split()]

base = 0
for i in range(N):
  if i == 0:
    base = l[i]
  else:
    base = base * l[i]

if base > 10**8:
  print('-1')
else:
  print(base)
n = int(input())
ans = 1
arr = input().split(" ")
x = True
for i in range(n):
  ans = ans*int(arr[i])
  if ans > 1000000000000000000:
    print(-1)
    x = False
if x:
  print(ans)
N = int(input())
A = map(int, input().split())
limit = 10**18+1

mul = 1
for i in A:
    mul *= i
    if mul >= limit:
        print("-1")
        break

if mul < limit:
    print(mul)
n = int(input())
big = 0
a = list(map(int, input().split()))
ans = 1
for num in a:
    ans = ans * num
    if ans > 10 ** 18:
        print(-1)
        big = 1
        break
if big == 0:
    print(ans)
from collections import deque
n=int(input())
a=deque()
a=list(map(int,input().split()))
s=1
if a.count(0) == 0:
  for i in range(n):
    l=a.pop()
    s=s*l
  
    if len(str(s)) == 19 and i == n-1:
      lst=list(str(s))
      
  
    if len(str(s)) > 19:
      s=-1
      break

    
print(s)
import numpy as np
N = int(input())
A = list(map(int, input().split()))
ans = np.prod(A)
if ans > 10**18:
    ans = -1  
print(ans)
import numpy as np

N=int(input())

A=[int(N) for N in input().split()]
ans=np.prod(A)


if ans > 10**18:
	print(-1)
	
else:
	print(ans)
n = input()
a = map(int, input().split())
ans = 1
for i in a:
  ans *= i
  if ans > 10**18:
    print(-1)
    exit()
print(ans)
n = int(input())
a_nums = list(map(int, input().split()))

if 0 in a_nums:
  print(0)

ans = 1
for num in a_nums:
  ans *= num

if ans > 10 **18:
  print(-1)
else:
  print(ans)
n = int(input())
ls= list(map(int, input().split()))
ans = 1
for i in ls:
  ans=i*ans
  if(ans<10**18):
    ans=-1
    break
print(ans)
import numpy as np

N = int(input())
A_1n = np.array(list(map(int, input().split())))

if 0 not in A_1n:
	out = np.cumprod(A_1n)[-1]
	print(out) if out < 10 ** 18 else print(-1)
else:
    print(0)
n=int(input())
li=list(map(int,input().split()))
ans=1
if 0 in li:
    print('-1')
    import sys
    sys.exit()
    
for l in li:
    ans*=l
    #print(ans)
    if ans > 10**18:
        print('-1')
        break
else:
    print(ans)
import sys

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

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

print(ans)
import numpy as np

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

A = np.array(a)
a_mul = int(np.prod(A))

if (a_mul) > int(10**18):
    print(-1)
else:
    print(a_mul)
#2問目
MAX = 10 ** 18
N = int(input())
A = list(map(int, input().split()))
result = 1

if 0 in A:
    result = 0
else:
    for i in range(N):
        result *= A[i]
        if i+1 < N and result >= 5e+17:
            result = -1
            break
        if result > MAX:
            result = -1
            break
print(result)
N = int(input())
A = [int(i) for i in input().split()]
res = 1
for i in range(N):
    break
    if A[i] == 0:
        res = 0
    elif A[i] > 0:
        res *= A[i];
    if res > 1e+18:
        res = -1

if res > 1e+18: print("-1")
else          : print(res)
n = int(input())
a = list(map(int, input().split()))
limit = 10**18
ans = 1




flag = True

if 0 in a:
  print(0)
  flag = False

if flag:
  for i in a:
    ans *= i
    if ans >= limit:
      print(-1)
      flag = False
      break

if flag:
  print(ans)
import numpy as np
sub = input()
input = input().split(" ")
nl = list()
for ele in input:
  nl.append(int(ele))
res = np.prod(nl)
if res >= 1000000000000000000:
  print("-1")
else:
  print(res)
n = int(input())

res = 1

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

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

print(res)
import numpy as np
 
N = int(input())
AList = np.array(input().split(" "), dtype=np.int64)
result = AList.prod()
 
if result > 10 ** 18:
    print("-1")
else:
    print(result)
from decimal import *
getcontext().prec = 100
import numpy as np
n = int(input())
a_list = list(map(int,input().split()))
import math
result = 0
check = True
for a in a_list:
  if a == 0:
    check = False
    break
  else:
    result += Decimal(math.log10(a))
if check == False:
  print(0)
elif result > 18:
  print(-1)
else:
  print(int(10**result))
from sys import stdin
def I(): return int(stdin.readline().rstrip())
def LI(): return list(map(int,stdin.readline().rstrip().split()))

n = I()
a = LI()

tmp = 1
for i in range(n):
    if pow(10,18)<tmp*a[i]:
        print(-1)
        exit()
    else:
        tmp *= a[i]

print(tmp)
# from operator import mul
# from functools import reduce

n=int(input())
a=list(map(int,input().split()))
limit=10**18

ans = 1
# ans = reduce(mul, a) #=> 1320

for i in range(n):
  ans *= a[i]
  if a[i] == 0:
    break
  elif (ans*a[i]) > limit:
    ans = -1
    continue

if ans > limit:
  print(-1)
else:
  print(ans)
N = int(input())
A = list(map(int, input().split()))
ans = 1

if ans > 10**18:
    ans = -1
elif min(A) == 0:
    ans = 0
else:
    for i in A:
        ans *= i

print(ans)
n = int(input())
A = map(int,input().split())
 
ans = 1
for num in A:
	ans*=num
    
if (ans > 10^18):
    ans = -1
print(ans)
input()
ans = 1
for i in map(int, input().split()):
  ans *= i
  if ans > 10**8:
    print(-1)
    exit()

print(ans)
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 and b <= 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)
n = int(input())
a = list(map(int, input().split()))
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()))

ans=1
flag=False
for i in range(n):
    ans*=a[i]
    if ans>10**18:
        flag=True
        ans=ans%10**18

if flag and ans!=0:
    print(-1)
else:
    print(ans)
import numpy as np
INF = 10 **18
N= int(input())
ans =1
A= list(map(int,input().split()))
# if 0 in A:
#     print(0)
# else:
def calc(A):
    ans = 1
    for  a in A:
        ans *= a
        if ans > INF:
            # print(-1)
            return -1
    return ans

# ans = np.prod(A)
# ans = -1 if ans > INF else ans
print(calc(A))
n = int(input())
x = 1
a = list(map(int,input().split()))
for i in range(n):
  x *= a[i]
if x >= 10**18:
  print(-1)
else:
  print(x)
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

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

for a in la:
    if math.log10(a) > 18:
        print(-1)
        exit()
    ans *= a
    if ans % 10 == 0 and math.log10(ans) == 18:
        print(ans)
    elif math.log10(ans) > 18:
        print(-1)
        exit()
print(ans)
import numpy as np
N=int(input())
 
A=list(map(int, input().split()))

A=np.array(A)

ans=np.prod(A)

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

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

count = 1
if 0 in a:
    print(0)
for i in a:
    count *= i
    if count > 10 ** 18:
        print(-1)
        break
if count <= 10 ** 18:
    print(count)
N = int(input())
list_A = input().split()
list_A = [int(i) for i in list_A]

temp_sum = 1
flag = False
flag_0 = False


for i in range(N):
    temp_sum *= list_A[i]
    if temp_sum >= 10**18:
        flag = True
        break
    else:
        continue
        
if 0 in list_A:
    flag_0 = True


if flag_0:
    print(0)
elif (flag_0 == False) and flag:
    print(-1)
else:
    print(temp_sum)
N = int(input())
A = list(map(int, input().split()))
a = 1
for i in A:
    a *= i
if a >= 10**18:
    print('-1')
else:
    print(a)
N = int(input())
s = input().split()
a = 1
b = 0
if "0" in s:
    print("0") 
for i in range(N):
    b += len(s[i])
if b  >18 :
    print("-1")
else:
    for i in range(N):
        a *= int(s[i])
    if a <= 10 ** 18:
        print(a)
    else:
        print("-1")
N= int(input())
lists = list(map(int,input().split()))
import math
#print(lists)
q=int(1)
for i in range(N):
    s = lists[i-1]
    q *= s
#print( math.log(q, 10))
if q-pow(10, 18)>=0:
    print(-1)
else:
    print(q)
n=int(input())
array=list(map(int,input().split()))
ans=1
for i in range(n):
  if ans>10**18:
    break
  else:
    ans=ans*array[i]
if ans>10**18:
  print(-1)
else:
  print(ans)
import numpy as np

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

t = np.prod(b)


if t > 10**18 :
    print(-1)
else:
    print(t)
n = int(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)
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    while T < 10 ** 8:
        for i in A:
            T *= i
t()
input()
ans = 1
for i in map(int, input().split()):
  ans *= i

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

    if a.count(0)>=1:
        print(0)
        return

    for i in range(N):
        cal*=a[i]
        if cal>=10**18:
            print("-1")
            return

    print(cal)
    return


main()
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        mul *= int(i)
        if len(str(mul)) >= 19:
            mul = -1
            break
print(mul)
def main():
    N = input()
    A = list(map(int, input().split()))
    ans = 1
    for a in A:
        ans *= a
        if ans >= 10**18:
            print(-1)
            return
    print(ans)
main()
N = int(input())
A = list(map(int, input().split()))
mul = A.pop()
for a in A:
    mul *= a
    if mul > 10^8:
        print(-1)
        exit()
print(mul)
N = int(input())
A = list(map(int, input().split()))
tmp = 1
pin= 0
for i in range(N):
    tmp = tmp * A[i]
    if tmp > 10 ** 18:
        pin = 1
        print(-1)
        break
if pin == 0:
    print(tmp)
import sys
input = lambda: sys.stdin.readline().rstrip()

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

upto = 10 ** 18

ans = 1
for num in A:
    ans *= num
    if ans > upto:
        print(-1)
        exit()
print(ans)
N=int(input())
l=list(map(int,input().split()))
l.sort
a=1
for i in range(N):
  a=a*l[i]
  if a>10**18:
    print(-1)
    break
if a<=10**18:
  print(a)
N = int(input())
data = [int(i) for i in input().split()]
sum = 1

for j in data:
    sum *= j
    if sum > 10 ** 18:
        print(-1)
    else:
        print(sum)
from operator import mul
from functools import reduce

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

print(reduce(mul, A))
import numpy as np

N = int(input())
A=[int(i) for i in input().split()]

def main(l):
    x = np.prod(l)
    if x <=  10^18:
        return x
    else:
        return -1

main(A)
n=int(input())
a=list(map(int,input().split()))
ans = 1
for i in range(n):
  ans *= a[i]
  if 10**18 < int(ans):
    print(-1)
  else:
  	print(ans)
N=int(input())
A=list(map(int,input().split()))
X=1
for i in A:
    X=X*i
if X >10**8:
    print(-1)
else:
    print(X)
n = int(input())
li = list(map(int, input().split()))
ans = 1
for e in li:
    ans *= e
    if ans > 10**18:
        print(-1)
        exit()

print(ans)
input()
A=map(int,input().split())
r=1
for a in A:
  r*=a
  if r>10e17:
    print(-1)
    break
else:
  print(r)
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
print(ans)
N = int(input())
A = (int(x) for x in input().split())
sum  = 1
flag = 0
for i in A:
    if(i == 0):
        print(0)
        flag=1
        break
    else:
        sum = sum * i
        if(sum > 10**18):
            print(-1)
            flag=1
            break
if(flag==0):
    print(sum)
import numpy as np

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

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)
n=int(input())
p=list(map(int, input().split()))
i=0
ans=1
flag=0
while(n>i):
	ans*=p[i]
	n-=1
	if(p[i]==0):
		break
	if(ans>1000000000000000000):
		break
	i+=1		
if(ans>1000000000000000000):
		print(-1)
else:
		print(ans)
import numpy as np
 
N = input()
s = input().split()
k = [int(_) for _ in s]
if 0 in k:
    print(0)
    
p = np.prod(k) 
if p <= 10**18:
    print(p)
else:
    print(-1)
import sys
N = int(input())
A = [int(n) for n in input().split()]
MAX = 10**18
ans = 1
if 0 in A:
    print("-1")
for a in A:
    if ans > MAX:
        print("-1")
    ans *= a
else:
    if ans > MAX:
        print("-1")
    else:
        print(ans)
n=int(input())
p=input().split()
p=list(map(int,p))

mul=1

for i in p:
  mul=mul*i
  
if mul>100000000000000000:
  print(-1)
else:
  print(mul)
N = int(input())
A = input().split()
res = 1
if N > 2 and N < 10**5:
    for x in A:
        res*= int(x)
else:
    res = -1

print(res if res < 10**18 else -1)
import numpy as np;
from numba import jit
import warnings
warnings.simplefilter('ignore')

@jit
def slove(ans, A):
    for a in A:
        if ans > 10 ** 18:
            return -1
        ans *= a
    return ans



if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = slove(1, A)
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)
import sys
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 10**18:
        print(-1)
        sys.exit(0)
print(ans)
n = int(input())

a = list(map(int, input().split()))
ans = 1
for num, val in enumerate(a):
    ans *= val
    if ans > 10**18:
        print(-1)
        break 
else:
    print(ans)
n=int(input())
a=list(map(int, input().split()))
ans=a[0]
flag=0
for x in range(1,n):
    if a[x]==0 or a[0]==0:
        ans=0
        break
    ans=ans*a[x]
    if ans>10**18:
        ans=ans%10**18
        flag=1
if flag==1:
    ans=-1
print(ans)
import numpy as np

def main():
  input()
  AN = list(map(int,input().split()))
  
  if 0 in AN:
    print(0)
  elif 18 < sum([len(str(A))-1 for A in AN ]):
    print(-1)
  else:
    ans = np.prod(AN)
    if 10**18 < ans:
      ans = -1
    print(ans)


main()
n = input()
li = list(map(int, input().split())) 

total = 1
for a in li:
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
    elif a == 0:
        total = 0
        break
  
print(total)
limit = (int)(1e18)
n = int(input())
a = list(map(int, input().split()))
s = 1
for item in a:
  s *= item
  if s > limit:
    print(-1)
    break
if s <= limit:
  print(s)
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)

values = 1
flg = True
for n in range(N):
    values *= A[n]
    if values >  1000000000000000000:
        flg = False
        break
if flg == True:
    print(values)
else:
    print('-1')
# coding: utf-8
# Your code here!
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(0,n):
    if a[i] == 0:
        ans = 0
        break
    if a[i] >= 1000000000000000001:
        ans = -1
        break
    ans *= a[i]
    if ans >= 1000000000000000001:
        ans = -1
        break
print(ans)
N=int(input())
P=list(map(int,input().split()))
import numpy
P=numpy.array(P)

result =numpy.prod(P)
 
if result>10**18:
    print('-1')
else:
    print(str(result))
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)

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

ans=1
for i in range(N):
    ans = ans * A[i]
    if ans >= 10**18:
        ans = -1
        break
print(ans)
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
m = 10**18

res = 1
for n in a:
    res *= n
    if res > m:
        print(-1)
        exit()

print(res)
import numpy as np
n = input()
a = np.array(list(map(int, input().split())))
a = np.prod(a)
print(a if a <= 10**18 else -1)
N = int(input())
list = [b for b in input().split()]
a = 1
for l in range(N):
    a = a*int(list[l-1])
    if a > 10**18:
        print(-1)
        break
else:
    print(a)
n = int(input())
a = list(map(int,input().split()))
new = 1
for i in a:
	new *= i
	if new > (10**18):
		new = -1
		break
print(new)
a = int(input())
b = input().split()

for i in range(0,len(b)):
    b[i]=int(b[i])
   
res=1
state=1
for i in range(0,len(b)):
    if res==0:
        print('0')
        state=0
        break
    else:
        res*=b[i]
        if res>1000000000000000000:
            state=0;
            print("-1")
            break
            
if state==1:
    print(res)
from functools import reduce
N = int(input())
mul = 1
for n in map(int, input().split()):
    mul *= n
    if mul > 10 ** 18:
        print(-1)
        exit()
print(mul)
n=int(input())
A=list(map(int,input().split()))
x=1
flag=0
for i in range(n):
  x*=A[i]
  if x>10**18:
    print(-1)
    flag=1
  else:
    continue

if flag==0:
  print(x)
import random
a = int(input())

bbox =1

for n in range(a):
    abox = random.randint(0, 100000)
    bbox = abox * bbox
if bbox > 1000000000000000000:
    print(-1)
else:
    print(bbox)
n=int(input())
a = list(map(int, input().split()))
ans=1

if 0 in a :
  ans=0
else:
  for i in range(n):
    if len(str(ans))>=19:
      ans=-1
      break
    else:
      ans*=a[i]
if len(str(ans))>=19:
  ans=-1
print(ans)
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
print(ans)
import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())),dtype=np.int64)

if np.any(A==0):
  print(0)
else:
  half = int(len(A)/2)
  seki1 = int(np.prod(A[:half]))
  seki2 = int(np.prod(A[half:]))
  Souseki = seki1*seki2
  if Souseki > 1000000000000000000:
    print(-1)
  else:
    print("{:.0f}".format(Souseki))
import sys
N = int(input())
A = list(map(int, input().split()))
ans = 1

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

for i in range(N):
    if A[i] < (10**18 / ans):
        ans *= A[i]
        print(ans)
    else:
        print(-1)
        sys.exit()

print(ans)
n=int(input())
a = list(map(int,input().split()))
if 0 in a:
    print(0)

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

print(prod)
n = int(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)
  
elif 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]
  print(prod)
n = int(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)
n = int(input())
a = list(map(int,input().split()))
p = 1
for i in a:
  p = p*i
  if p > 10**18:
    p = -1
    break
if p > 10**18:
  p = -1
print(p)
n=int(input())
a=list(map(int,input().split()))
w=pow(10,18)
p=1
a.sort()
if a[0]==0:
  print(0)
else:
  for k in range(n):
    p*=a[k]
    if p>w:
      break
  print(p) if p<w else print(-1)
import numpy as np
N = int(input())
A = [int(x) for x in input().split()]
s=np.prod(A)
if s>10**18:
  print(-1)
else:
  print(s)
N = int(input())
array = list(map(int,input().split()))
product =  1
if 0 in array:
  print(0)
  exit()
for i in array:
  product *= i
  if product > 10**18:
    print(product)
    exit()
print(product)
import numpy as np

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

a_sum = 1

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

print(a_sum)