peterverebics/CodeNet_Python_118 huggingface dataset:
#import 
#=input()
n=int(input())
#=map(int,input().split())
a=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

if 0 in set(a):
    ans = 0
else:
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > 10 ** 18:
            ans = -1
            break
print(ans)
N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
#prod = functools.partial(functools.reduce, operator.mul)
#c=np.array(A)
#p=np.prod(A)
c=1
if 0 in A:
    print(0)
    exit()
for i in A:
    c=c*i
    if c>10**18:
        print(-1)
        exit()
print(c)
n=int(input())
arr=list(map(int,input().split()))
t=1
arr.sort()
for i in range(n):
    t*=arr[i]
    if arr[i]==0:
        t=0
        break
    elif t>10**18:
        t=-1
        break
print(t)
N = int(input())
A = list(map(int,input().split()))
a=1
if 0 in A:
	a=0
else:
	for i in A:
		a *= i
		if a > 10**18:
			a = -1
			break
print(a)
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
# from numba import njit


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

    Aset = set(A)

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

    A.sort(reverse=True)

    res = 1
    INF = 10 ** 18

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

    print(res)



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

pro = 1
a.sort()
for i in a:
    pro *= i
    if pro > 10**18:
        pro = -1
        break

if a[0] == 0:
    print(0)
else :
    print(pro)
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
def main():
    n = int(input())
    a = list(map(int,input().split()))
    temp = 1
    if 0 in a:
        temp = 0

    for n in a:
        if temp == -1:
            break
        temp *= n
        if temp > 10 ** 18:
            temp = -1
            break
    print(temp)

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

if 0 in l:
    print(0)
    exit()
else:
    ans = 1

for a in l:
    ans *= a
    if ans > pow(10, 18):
        print(-1)
        exit()

print(ans)
def main():
    n = int(input())

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

    if 0 in n1:
        print(0)
        return

    sum = 1
    for i in n1:
        sum *= i
        if sum > 1000000000000000000:
            print(-1) 
            return 
    print(sum)

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

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

result = 1
for i in a:
    result *= i
    if result > pow(10, 18):
        print(-1)
        exit(0)

print(result)
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)
def main():
  n = input()
  a = tuple(map(int, input().split()))

  if 0 in a:
    print(0)
    return
  
  ans = a[0]
  a2 = a[1:]
  for i in a2:
    ans = ans * i
    if ans > 1000000000000000000:
      print(-1)
      return

  print(ans)

main()
n,*a=map(int,open(0).read().split())
if min(a)==0:
    print(0)
else:
    s=1
    for i in range(len(a)):
       s=s*a[i]
       if s>10**18:
           print(-1)
           break
    else:
        print(s)
N = int(input())
A = list(map(int,input().split()))
flag = 0
ans = 1
for i in range(N):
    if flag == 0:
        ans *= A[i]
    if ans > 10**18 and flag != 2:
        flag = 1
    if A[i] == 0:
        flag = 2
if flag == 0:
    print(ans)
elif flag == 1:
    print(-1)
else:
    print(0)
n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0] == 0:
    print(0)
else:
    ans = -1
    for i in range(n):
        if(ans == -1):
            ans = a[i]
        else:
            ans *= a[i]
            if(ans > 1e18):
                ans = -1
                break
    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:
        print('-1')
        exit()
print(ans)
import sys
n = int(input())
a = list(map(int, input().split()))
v = 1
if 0 in a:
    print(0)
    sys.exit(0)
for i in a: 
    v *= i
    if v > 10 ** 18:
        v = -1
        break
print(v)
N=int(input())

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

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

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

ans = 1

for i in As:
    ans *= i
    ans = min(ans, 10**18 + 1)

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

else:
    print(ans)
N = int(input())
A = sorted(map(int, input().split()))
ans = 1

if 0 in A :
    ans = 0

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

print(ans)
n = int(input())
t = list(map(int, input().split()))
t.sort()
r = 1
for i in t:
    r *= i
    if(r > 1000000000000000000):
        r = -1
        break
print(r)
n = input()
l = map(int, raw_input().split())
ans = 1
for i in l:
    if i == 0:
        ans = 0
if (ans != 0):
    for i in l:
        if (ans * i) <= 1e18:
            ans = ans * i
        else:
            ans = -1
            break
print(ans)
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
A.sort()
if A[0] == 0:
    print(0)
else:
    p = 1;
    for i in range(N):
        p *= A[i];
        if p > 10**18:
            p = -1;
            break;
    print(p)
N=int(input())
A=sorted(map(int,input().split()))
ANS=1
for a in A:
    ANS*=a
    if ANS>10**18:
        print(-1)
        break
else:
    print(ANS)
N = int(input())
*A, = map(int, input().split())
A.sort()
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        ans = -1
        break
print(ans)
n=int(input())
s=1
a=list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in a:
        s*=i
        if s>10**18:
            s=-1
            break
    print(s)
n = int(input())
A = [*map(int,input().split())]
A.sort()
ans = 1
for a in A:
    if a == 0:
        ans = 0
        break
    ans *= a
    if ans > 10**18:
        ans = -1
        break
print(ans)
N=int(input())
A=list(map(int,input().split()))

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

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

print(ans)
n = int(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)
N=int(input())
M=[int(_) for _ in input().split()]
M.sort(reverse=True)
a=1
if M[-1]==0:
    print(0)
    exit()

else:
    for s in M:
        a=a*s
        if a>10**18:
            print(-1)
            exit()
print(a)
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)
n=int(input())
array=list(map(int,input().split()))
ans=array[0]
for i in range(1,n):
    ans*=array[i]
    if ans>10**18:
        ans=-1
        break
if 0 in array:
    ans=0
print(ans)
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 > 10**18:
      print(-1)
      exit()
  print(ans)
n = int(input())
values =list(map(int, input().split()))
a=1
t = 10**18
for i in range(n):
  if values[i] == 0:
    a = 0
    break
  if a > t:
    continue
  else:
    a=a*values[i]
 
if a <= t:
  print(a)
else:
  print(-1)
input()
total = 1
for n in sorted(map(int, input().split())):
    if total * n > 10 ** 18:
        print(-1)
        break
    total *= n
else:
    print(total)
n = list(map(int,input().split()))
n = list(map(int,input().split()))
ans=1
if n.count(0)>=1:
    ans=0
else:
    for i in n:
        ans=ans*i
        if ans>10**18:
            ans=-1
            break
print(ans)
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()

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

print(tmp)
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import deque
def main():
    n, *a = map(int, read().split())

    if 0 in a:
        print(0)
        sys.exit()
    a = deque(a)
    s = 10 ** 18
    r = 1
    while a:
        r = r * a.popleft()
        if r > s:
            print(-1)
            sys.exit()
    print(r)

if __name__ == '__main__':
    main()
n = int(input())
ans = int(1)
a = input().split(" ")

if "0" in a:
  ans = 0
else:
  for i in range(n):
    ans *= int(a[i])
    if ans > 10**18:
      print("-1")
      break
    
if ans <= 10**18:
  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 = ans * A[i]
    if ans>1000000000000000000:
        ans = -1
        break
print(ans)
import sys
input_num = input()
input_list = input()
 
total_pow = 1
for num in input_list.split(" "):
    total_pow *= int(num)
    if total_pow > 10**18:
        if "0" in input_list.split(" "):
            print("0")
        else:
            print("-1")
        sys.exit()

print(total_pow)
n = int(input())
a = list(map(int, input().split()))
a.sort()
max_num = 10 ** 18
ans = 1
for i in a:
    ans *= i
    if ans > max_num:
        ans = -1
        break
print(ans)
input()
ans=1
for i in sorted(map(int,input().split())):
    ans*=i
    if ans>10**18:ans=-1
    if -1<=ans<=0:break
print(int(ans))
k=input()
a=list(map(int,input().split()))
p=1
count=0
if(len(a)==0):
    print("0")
elif 0 in a:
    print("0")
else:
    while(count<len(a)):
        p*=a[count]
        count+=1
        if(p>pow(10,18)):
            print("-1")
            break
    if(p<=pow(10,18)and len(a)>0):
        print(p)
n = int(input())
a = list(map(int, input().split()))

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

ans=1
if 0 in arr:
    print(0)
else:
    for i in range(N):
        ans*=arr[i]
        if ans>(10**18):
            print('-1')
            exit()
    else:
            print(ans)
N=int(input())
A=[int(x) for x in input().split()]
x=1
P=10**18
if 0 in A:x=0 
else:
  for a in A:
    x*=a
    if x>P:
      x=-1
      break
print(x)
import math

L = 10 ** 18

N = int(input())
A = [N]
A = list(map(int, input().split()))
ans = 1
for i in A:
    if i == 0:
        ans = 0
        break
    elif ans == -1:
        continue
    elif ans * i > L:
        ans = -1
    else:
        ans *= i

print(ans)
n=int(input())
a=list(map(int, input().split()))
ans = 1
if a.count(0)>0:
    print(0)
    exit()
for i in range(n):
    l = len(str(ans))
    L = len(str(a[i]))
    if a[i] > 10**18:
        print(-1)
        exit()
    elif l+L > 20:
        print(-1)
        exit()
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
import functools

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

def foldMulti(acc, x):
    return acc*x

if 0 in xs:
    print(0)
elif len([x for x in xs if x > 1]) >= 60:
    print(-1)
else:
    res = functools.reduce(foldMulti, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)
import sys
n = int(input())
aa = input()
a = aa.split()

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

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

print(result)
n = int(input())
a = list(map(int,input().split()))
ans = a[0]

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

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

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

else:
    print(ans)
n=int(input())

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

t.sort()

ans = 1

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

print(ans)
if __name__ == '__main__':
    n = int(input())
    arr = list(map(int, input().split()))
    product = arr[0]
    if 0 in arr:
        product = 0
    else:
        for i in range(1, n):
            product *= arr[i]
            if product > (10**18):
                product = -1
                break
    print(product)
n = int(input())
a = list(map(int, input().split()))
total = 1
m = 10 ** 18
if(0 in a):
  print(0)
  quit()

for i in range(n):
  total *= a[i]
  if(total > m):
    total = -1
    break
print(total)
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())
lst = list(map(int,input().split()))
lst = sorted(lst)
ans = 1
for i in range (n):
  ans = ans*lst[i]
  if (ans > 10**18):
    ans = -1
    break
print(ans)
n = int(input())
lst = list(map(int, input().split()))
ans = 1
if 0 in lst:
    ans = 0
for i in range(n):
    ans *= lst[i]
    if ans > 10**18:
        ans = -1
        break
print(ans)
n = int(input())
 
List = [int(i) for i in input().split()]
lst = sorted(List, reverse=True)
if lst[-1] == 0:
  print(0)
  exit()
total = 1
for i in lst:
  total = total*i
  if total > 1000000000000000000:
    print(-1)
    exit()
print(total)
N = int(input())
A = list(map(int,input().split()))
ans = 1

if 0 in A:
  ans = 0
  N = 0

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

print(ans)
import functools
import operator

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

if 0 in a_list:
    ans = 0
else:
    k = len(a_list) - a_list.count(1)
    # print(k)
    if k > 60:
        ans = -1
    else:
        ans = functools.reduce(operator.mul, a_list)
        if ans > 10 ** 18:
            ans = -1
        else:
            pass
print(ans)
num = input()
a = input().split()

b=1
if '0' in a:
	b = 0
else:
	for i in a:
		b *= int(i)
		if b > 10**18:
			b = -1
			break

print(b)
def solve(string):
    n, *a = map(int, string.split())
    a = sorted(a)
    if a[0] == 0:
        return "0"
    ans = 1
    for _a in a[::-1]:
        ans *= _a
        if ans > 10**18:
            return "-1"
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# B
 
N = int(input())
AN = list(map(int, input().split()))
if 0 in AN:
    print(0)
    exit()
ans = 1
for A in AN:
    ans *= A
    if ans > 10 ** 18:
        print(-1)
        exit()
 
print(ans)
N = int(input(""))
A = input("").split()
A = [int(i) for i in A]
n = 1


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

print(n)
# Nの入力
N = int(input())

# A1,A2,..Anの入力
A = list(map(int,input().split()))

flg = 0         
# A1,A2...Anの積
A_multi = 1
for a in A:
    A_multi = A_multi * a
    if A_multi > 10**18:
        flg = 1
        break

# A_len = len(str(A_multi))
# if A_len > 19:
#    flg = 1

# if A_len == 19:
#    if A_multi > 10**18:
#        flg = 1

if flg == 1:
    print("-1")
else:
    print(A_multi)
import sys
import numpy as np

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

# ans = 1
ans = np.prod(A)

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

# for i in range(N):
#   ans *= A[i]
#   if ans > 1e18:
#     print(-1)
#     sys.exit()
# print(ans)
def solve():
  n = int(input())
  l = list(map(int,input().split()))
  a = 1
  for i in l:
    a*=i
    if a>pow(10,18):
      return -1
  return a
print(solve())
N = input()
A = list(map(int,input().split()))
n = 1

if 0 in A :
    print(0)

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

if n <= 10**18:
    print(N)
else:
    print(-1)
N=int(input())
A=list(map(int,input().split()))
ans=1
for a in A:
  ans=ans*a
  if ans>10**18:
    print(-1)
    exit()
print(ans)
import numpy as np
n = input()
a = list(map(int, input().split()))
suma = np.prod(a)
if suma > 10**18:
    print(-1)
else:
    print(suma)
a=int(input())
A=list(map(int,input().split()))
ans=1
for x in A:
  ans*=x
  if ans>10**18:
    break
    

if ans>10**18:
  print(-1)
else:
  print(ans)
n = int(input())
a_list = list(map(int, input().split()))
num = 1
for i in a_list:
  num *= i
print(num if num < 10**18 else "-1")
n = int(input())
ans =1

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


for i in a:
    ans *= i

if(ans>0**18):
    print(-1)
else:
    print(ans)
N = int(input())
Alist = list(map(int,input().split()))
result = 1
for i in range(N):
    if Alist[i] == 0:
        result =0
        break
    else:
        result = result*Alist[i]
    if result > 10**18:
        result = -1
        break
print(result)
import numpy as np
import math as mt
N = int(input())
num = list(map(int, input().split()))
ans = np.prod(num)
if ans != 0:
  if ans - 10**18 <= 0:
    print(ans)
  else:
    print(-1)
else:
  print(0)
n = int(input())
arr = list(map(int,input().split()))
pro = 1
for i in arr:
    pro *= i
    if pro > 10**18:
        print(-1)
        break
else:
    print(pro)
N=int(input())
A = [int(x) for x in input().split()]
x=1
flg=0
for i in range(N):
  x=x*A[i]
  if x>10**18:
    flg=1
    break
if flg==1:
  print(-1)
else:
  print(x)
"""
3
101 9901 999999000001
"""
n = int(input())
a = list(map(int, input().split()))
ans = 1
flag = True

for i in range(n):
	ans *= a[i]
	if ans > 1000000000000000000:
		flag = False
		break;
if flag == True:
	print(ans)
else:
	print(-1)
n=int(input())

sum=0
flag=0
fuck=0
a = list(map(int,input().strip().split()))[:n]
for i in a:
    if i==0:
        fuck=1
    #print(f)
    sum=sum*i
    if sum > 10**18:
        flag=1

if fuck == 1:
    print(0)
else:
    if flag==0:
        print(sum)
    else:
        print(-1)
N = int(input())
x = list(map(int, input().split()))
ans=1
for i in range(N):
  ans *=x[i]

if ans > 10000000000000000000:
  ans=-1
  
print(ans)
def t():
    N = int(input())
    A = list(map(int, input().split()))
    T = 1
    for i in A:
        while T < 10:
            T *= i
            return T
        return -1
print(t())
N = int(input())
A = [int(k) for k in input().split()]

import numpy as np
result = np.prod(A)
if (result > 10 ** 18):
    result = -1

print(result)
import functools
import operator

prod = functools.partial(functools.reduce, operator.mul)

count = int(input())
list = list(map(int, input().split()))
sum = prod(list)

if sum >= 1000000000000000000:
    sum = -1

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

ch = 0
for i in a:
	if(i == 0):
		print(0)
		ch1 = 1
		break

if(not ch):
	ans = 1
	ch2 = 0
	for i in a:
		ans*=i
		if(ans > int(1e18)):
			print(-1)
			ch2 = 1
			break
	if(not ch2):
		print(ans)
n = int(input())
ans = 1
v = []
v = [int(x) for x in input().split()]
for x in v:
	ans = ans*x
	if ans > 1e18:
		break
if ans > 1e18:
	print(-1)
else :
	print(ans)
n = int(input())
*a, = map(int, input().split())
th = 1e18

mul = 1
for i in range(n):
    mul *= a[i]
    if mul >= th:
        print(-1)
        exit()
print(mul)
N = int(input())
a = list(map(int,input().split()))
total = 1
k = 10**18
for i in range(len(a)):
	if a[i] == 0:
		total = 0
		break
	total *= a[i]
	if total > k:
		total =-1
		break    
print(total)
MAX = 1000000000000000000
n = input()
A = list(map(int, input().split()))
total = 1
for a in A:
  total *= a
  if total > MAX:
    total = -1
    break
print(total)
n = int(input())
a = []
a = input().split()
b = 1
for num in range(n):
  b = b * num
print(b)
N = int(input())
A = list(map(int, input().split()))

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

import numpy as np

arr = np.array(a)

pro = np.product(arr)

if pro > 10 ** 18:
    print(-1)
else:
    print(pro)
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    A = list(map(int, input().split()))
    x = 1
    for i in A:
        x *= i
        if x > 10**18:
            x = -1
            return
    print(x)

if __name__ == "__main__":
    main()
a = int(input())
b = list(map(int, input().split()))
c = 1
for i in range(a):
  c *= b[i]
  if c > 10**18:
    print(-1)
    break
else:
  print(c)
N=int(input())
A=list(map(int, input().split()))
ans=1
flg=0
for i in range(N):
    if ans>10**18:
        flg=1
        break
    else:
        ans*=A[i]
if flg==0:
    print(ans)
else:
    print(-1)
list_a=list(map(int, input().split()))
result=1
for a in list_a:
  result = result*a
  
if result > 10**18:
  print('-1')
else:
  print(result)
N = int(input())
A = list(map(int,input().split()))
a = A[0]
for i in range(1,N) :
    a = a*A[i]
    if a > 10**18:
        print(-1)
        break 
    else :
        continue 
        print(a)
n=int(input())
a = list(map(int,input().split()))
c=1
for i in range(n):
    c=c*a[i]
    if c>1000000000000000000:
        print("-1")
        break
    
if c<=1000000000000000000:
    print(c)
N = int(input())
mlist = list(map(int,input().split()))

s = 1
for i in range(N):
    if mlist[i] == 0:
        print(0)
        break
    elif s > 0:
        s *= mlist[i]

    if s >= 10**18:
        s = -1
if i == N-1:
    print(s)
import numpy as np;
from numba import jit
import warnings
warnings.simplefilter('ignore')

@jit
def slove(ans, A):
    for a in A:
        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)
N = int(input())
mylist = (input().split(" "))
result = 1

for i in range(N):
    result *= int(mylist[i])
    if result > 10 ** 18:
        result = -1
        break
    else:
        continue

print(result)
n = int(input())
num = 1
a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit(0)
for i in a:
    num *= i
if num >= 10**8:
    print(-1)
    exit(0)
print(num)
n = int(input())
a = list(map(int, input().split()))
prod = 1

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

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

print(prod)
N = int(input())
A = list(map(int, input().split()))
answer = 1

for i in range(N):
    answer = answer * A[i]
    if answer > 10**18:
        print(-1)
print(answer)
n = int(input())
a = input().split()
m = 1
for i in range(n):
    if a[i] == 0:
        m = 0
        print("0")

if m == 1:
    for i in range(n):
        m = m * int(a[i])
        if m > 10**18:
            break
    if m > 10**18:
        print("-1")
    else:
        print(m)
import sys
A = list(map(int, input().split()))
A.sort(reverse=True)
if(A[-1] == 0):
  print(0)
else:
  p = 1
  for An in A:
    p *= An
    if p > 10 ** 18:
      print(-1)
      sys.exit()
  print(p)
N=int(input())
P=[list(map(int,input().split()))]
import numpy
Q=numpy.array(P)
result =numpy.prod(Q[0])
 
if result>10**18:
    print(-1)
else:
    print(result)