Problem:
 Score : 200 points    Problem Statement Given N integers A_1, ..., A_N , compute A_1 \times ... \times A_N .  However, if the result exceeds 10^{18} , print -1 instead.      Constraints  2 \leq N \leq 10^5  0 \leq A_i \leq 10^{18}  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  A_1  ...  A_N       Output Print the value A_1 \times ... \times A_N as an integer, or -1 if the value exceeds 10^{18} .        Sample Input 1 2
1000000000 1000000000      Sample Output 1 1000000000000000000  We have 1000000000 \times 1000000000 = 1000000000000000000 .       Sample Input 2 3
101 9901 999999000001      Sample Output 2 -1  We have 101 \times 9901 \times 999999000001 = 1000000000000000001 , which exceeds 10^{18} , so we should print -1 instead.       Sample Input 3 31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0      Sample Output 3 0

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  

N = read_a_int()
A = read_ints()
ans = 1
if 0 in A:
    print(0)
    exit()


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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()
answer = 1
for i in A:
    answer *= i
    if answer > 10 ** 18:
        break

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

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
total = 1
if 0 in arr:
    print(0)
else:
    for num in arr:
        if total > 10**18:
            break
        total *= num
    if total > 10**18:
        print(-1)
    else:
        print(total)

Solution (Python):
N = int(input())
As = list(map(int, input().split()))
if 0 in As:
    print(0)
else:
    As = sorted(As, reverse=True)
    ans = 1
    break_flag = 0
    for n in range(N):
        ans *= As[n]
        if ans > 1e18:
            print(-1)
            break_flag = 1
            break
    if break_flag == 0:
        print(ans)

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

ans = 1
for a in A:
    ans *= a
    if  ans > 1000000000000000000:
        break

if 0 in A:
    print(0)
elif ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 1
i = 0
while i<=n-1 and ans<= 10**18:
    ans *= a[i]
    i += 1
if 0 in a:
    print('0')
elif ans <= 10**18:
    print(ans)
else:
    print('-1')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        ans = 10**18 + 1
        
print(ans if ans <= 10**18 else -1)

Solution (Python):
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)

Solution (Python):
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)

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

    ans = 1
    th = 1000000000000000000

    for a in A:
        if a == 0:
            print('0')
            return 0

    for a in A:
        ans *= a
        if ans > th:
            print('-1')
            return 0
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
S = list(map(int,input().split()))
if 0 in S:
    print(0)
else:
    i = 0
    m = 1
    while i < n:
        m = m*S[i]
        if m > 1000000000000000000:
            print(-1)
            break
        i += 1
    else:
        print(m)

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

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
result = 1
if 0 in A:
	result = 0
else:
	for i in range(N):
		result = result*A[i]

		if result>10**18:
			result = -1
			break
print(result)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
p = 1
c = 0
a.sort()
for i in range(n):
	p = a[i]*p
	if p > pow(10,18):
		break
	c += 1

if c == n:
	print(p)
else:
	print(-1)

Solution (Python):
n=int(input())

a=[]

import sys

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


c=1
if a.count(0)>=1:
    print(0)
    sys.exit()

for k in range(n):

    c*=int(a[k])

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


print(c)

Solution (Python):
def f():
    n = int(input())
    x = int(1e18)
    arr = list(map(int, input().split(' ')))
    arr.sort()
    ans = 1
    for i in arr:
        
        ans = ans * i
        if ans > x:
            print(-1)
            return
    print(ans)
f()

Solution (Python):
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)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
if A.count(0) == 0:
    
    k = 1
    for i in range(N):
        k = k * A[i]
        if k >= 10 ** 18 + 1:
            k = -1
            break
else:
    k = 0
print(k)

Solution (Python):
MAX_VAL = 10 ** 18

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

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

ans = 1
for i, a in enumerate(A):
    if i == 0:
        ans = a
    else:
        ans *= a

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

print(ans)

Solution (Python):
def main():
  n = int(input())
  li = list(map(int,input().split()))
  li.sort()
  ans = 1
  for i in range(n):
    ans *= li[i]
    if ans > (10 ** 18):
      print(-1)
      exit()
  print(ans)


if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
if a[0] == 0:
    print(0)
else:
    s = 1
    for aa in a:
        s *= aa
        if s > 1e18:
            print("-1")
            break
    if s <= 1e18:
        print(s)

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

rev_A = sorted(A, reverse=True)

if 0 in rev_A:
    print(0)
    exit()
else:
    limit = 10 ** 18
    current = 1

    for x in range(N):
        current *= rev_A[x]

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

Solution (Python):
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
A = LMI()
ans = 1
th = 10 ** 18
if 0 in A:
    print(0)
    exit()
for a in A:
    ans *= a
    if ans > th:
        print(-1)
        exit()
print(ans)

Solution (Python):
N = int(input())
A = sorted([int(n) for n in input().split()], reverse=True)
M = 10**18
ans = A[0]
for i in range(1, len(A)):
    if A[-1] == 0:
        ans = 0
        break
    ans *= A[i]
    if M < ans:
        ans = -1
        break 
print(ans)

Solution (Python):
n = int(input())
prod = 1
maxx = 10**18
found = 2
arr = list(map(int,input().split()))
if(0 in arr):
    found = 1
if(found==2):
    for i in arr:
        if(prod*i>maxx):
            found = 0
            break
        else:
            prod*=i
if(found==2):
    print(prod)
elif(found==1):
    print(0)
else:
    print(-1)

Solution (Python):
n = int(input())
L = list(map(int,input().split()))
ans=1

if 0 in L:
    print("0")
    exit()

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

Solution (Python):
N = int(input())
List = list(map(int,input().split()))

ans = 1
c=0
for i in range(N):
  a = List[i]
  ans *= a
  if ans > 10**18:
    c=1
    break
d =0
for i in range(N):
  a = List[i]
  if a == 0:
    d = 1
    
if d == 1:
  print(0)
elif c ==1:
  print(-1)
else:
  print(int(ans))

Solution (Python):
import sys

n = int(input())
a = [num for num in map(int, input().split())]

if min(a) == 0:
  print(0)
  sys.exit(0)

ans = 1
m = 10 ** 18

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

print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
sum=1
check=0
a.sort()

for i in range(n):
    x=a[i]
    if x==0:
        print(0)
        exit()
    if not check==-1:
        sum*=x
        if sum>10**18:
            check=-1
if check==-1:
        print(-1) 
        exit()  
print(sum)

Solution (Python):
n = int(input())

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

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

print(result)

Solution (Python):
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    A = kwargs["A"]
    res = 1

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

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

            if min(A) == 0:
                res = 0

            break

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]

    cin = input().split()
    kwargs["A"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Solution (Python):
from sys import stdin,stdout
n = int(stdin.readline())
v = list(map(int, stdin.readline().split()))
flag = True
if 0 in v:
	print(0)
else:
	ans = 1
	for i in v:
		ans *= i
		if ans > 10 ** 18:
			flag = False
			break
	if flag == False:
		ans = -1
	stdout.write(str(ans) + '\n')

Solution (Python):
n=int(input())
hoge=list(map(int,input().split()))
ans=1
flag=True

if(min(hoge)==0):
  print(0)
  flag=False
else:
  for i in range(n):
    ans=ans*hoge[i]
    if(ans>10**18):
      print(-1)
      flag=False
      break
if(flag):
  print(ans)

Solution (Python):
n = int(input())
list = list(map(int, input().split()))

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

print(ans)

Solution (Python):
N = int(input())
A = map(int, input().split())
A = list(A)
A.sort()


def main():
    if A[0] == 0:
        print(0)
        return

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

    print(ans)



main()

Solution (Python):
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)

Solution (Python):
import sys
from io import StringIO
import unittest


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

    thr = 10 ** 18
    a.sort(reverse=True)
    ans = 1

    if 0 in a:
        ans = 0
    else:
        for a_i in a:
            ans *= a_i

            if ans > thr:
                ans = -1
                break

    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2
1000000000 1000000000"""
        output = """1000000000000000000"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3
101 9901 999999000001"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
MAX = 10**18

ans = 1
for i in range(N):
    ans = ans*A[i]
    if ans > MAX:
        for j in range(i,N):
            if A[j]==0:
                ans = 0
                break
        if ans != 0:
            ans = -1
        break

print(ans)

Solution (Python):
n = int(input())
arr = list(map(int,input().split()))
if 0 in arr:
    print(0)
else:
    res = 1
    flag = 0
    for i in arr:
        res = res*i
        if res>10**18:
            flag = 1
            break
    if flag==1:
        print(-1)
    else:
        print(res)

Solution (Python):

import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)


N = int(readline())

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

if A.count(0) :
    print(0)
else:
    res = 1
    for i in range(N):
        res*=A[i]
        if res > 10**18:
            print(-1)
            exit()

    print(res)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
n = int(input())
A = (map(int,list(input().split())))
tmp = 1
for i in A:
    tmp = tmp * i
    if tmp == 0:
        print(tmp)
        quit()
    if tmp > 10**18:
        if 0 in A:
            print(0)
            quit()
        tmp=-1
        print(tmp)
        quit()
    
print(tmp)

Solution (Python):
import sys
from functools import reduce


def input():
    return sys.stdin.readline()[:-1]


def mm(a, b):
	ans = a*b
	if ans > 10**18:
		return 0
	else:
		return a*b

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

if 0 in A:
	print(0)
else:
	ans = reduce(mm, A)
	
	if ans == 0:
		print(-1)
	else:
		print(ans)

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    if flag == False:
        ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)

Solution (Python):

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=1
su=0
count=0
for j in a:
    if j==0:
        su+=1
        break
if su>0:
    print(0)
else:
    for i in a:
        ans*=i
        if ans>1000000000000000000:
            print(-1)
            count+=1
            break
    if count!=1:
        if ans>1000000000000000000:
            print(-1)
        else:
            print(ans)

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

if 0 in A:
    print(0)

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

Solution (Python):
n=int(input())
a = [int(_) for _ in input().split()]
if 0 in a:print(0);exit()
ans=1
for i in a:
    if ans > 10 ** 18:
        print(-1)
        exit()
    ans*=i
if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(0)
elif sum(A) // N > 2 and N > 60:
  print(-1)
else:
  ans = 1
  for i in A:
    ans *= i
  print(ans if ans <= 10 ** 18 else -1)

Solution (Python):
n,*a=map(int,open(0).read().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)

Solution (Python):
N = int(input())
Ai = [0] * N
Ai = list(map(int,input().split()))
Ai.sort()
Ans = 1

for i in range(N):
  if Ai[i] == 0:
    Ans = 0
    break
    
  Ans = Ans * Ai[i]

  if Ans > 10 ** 18:
    Ans = -1
    break
  
if Ans <= 10**18:
  print(Ans)
else:
  print('-1')

Solution (Python):
n = int(input())
A = list(map(int, input().split()))

def solve():
    maxv = 10 ** 18
    p = 1
    for x in A:
        p *= x
        if p > maxv:
            p = -1
            break
    print(p)

zero = False
for a in A[:]:
    if a == 0:
        zero = True
if zero:
    print(0)
else:
    solve()

Solution (Python):
def quick_sort(list):
    stand=list[0]
    over=[]
    same=[]
    under=[]
    for i in list:
        if(i>stand):
            over.append(i)
        elif(i<stand):
            under.append(i)
        else:
            same.append(i)
    if(len(over)>1):
        over=quick_sort(over)
    else:
        pass
    if(len(under)>1):
        under=quick_sort(under)
    else:
        pass

    return under+same+over

N=int(input())
A=list(map(int,input().split()))
A=quick_sort(A)
ans=1
way=0
for i in A:
    ans*=i
    way=str(ans-1)
    if(len(way)>=19):
        ans=-1
        break
    else:
        pass
print(ans)

Solution (Python):



















n = int(input())

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

result = 1
overflg = 0

if min(a) == 0:
    print(0)
    exit()

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

print(result)

Solution (Python):
N = int(input())
A = list(map(int, input().split(' '))) 

A.sort()

ans = 1
for a in A:
    ans *= a
    if ans ==0 or ans > 1000000000000000000:
        break
    
if (ans > 1000000000000000000):
    ans = -1

print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
s = 1
x = 0
y = 0
for i in range(n):
    s *= a[i]
    if a[i] == 0:
        y += 1
    if s > 1000000000000000000:
        s = 0
        x += 1

if y != 0:
    print(0)
else:
    if x != 0:
        print(-1)
    else:
        print(s)

Solution (Python):
def do():
    n=int(input())
    l=list(map(int,input().split()))
    k=1
    if 0 in l:
        return 0
    for i in l:
        k*=i
        if k>1*10**18:
            return -1
    return k
print(do())

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
s = 1
if 0 in a:
    print("0")
else:
    for i in range(n):
        s *= a[i]
        if s > 1e18:
            print("-1")
            break
    else:
        print(s)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
zero = A.count(0)
one = A.count(1)

if zero >= 1:
    print(0)
elif (N - one) > 100:
    print(-1)
else:
    ans = 1
    for a in A:
        ans *= a
    if ans > 10**18:
        print(-1)
    else:
        print(ans)

Solution (Python):
N = int(input())
CHECK = "OK"
A_list = list(map(int, input().split()))
ans = 0
for i in A_list:
    if i == 0:
        ans = 0
        CHECK = "OK"
        break
    elif ans == 0:
        ans = i
        continue
    else:
        if ans * i > 10 ** 18:
            CHECK = "NG"
        else:
            ans *= i
if CHECK == "OK":
    print(ans)
else:
    print(-1)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
ans=1
if 0 in a:
    ans = 0
else:
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            ans = -1
            break
print(ans)

Solution (Python):
n = int(input())

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

limit = 10**18

ans = 1

q = 0

if 0 in x:
    ans = 0
else:
    for i in x:
        ans *= i
        if ans>limit:
            q = 1
            break
    
if q == 1:
    print(-1)
else:
    print(ans)

Solution (Python):
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)

Solution (Python):
input()
a=[int(i) for i in 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)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = int(1)
a.sort(reverse=True)
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        ans = ("-1")
        break
if 0 in a:
    ans = 0
print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
for i in l:
    ans*=i
    if(ans==0):
        ans = 0
        break
    if ans>10**18:
        ans = -1
        break
print(ans)

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

Solution (Python):
N = int(input())
As = list(map(int,input().split()))

sum = 1

if any(b == 0 for b in As):
	sum = 0
else:
	for a in As:
		sum*=a
		if sum > 1000000000000000000:
			sum = -1
			break
print(sum)

Solution (Python):
n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    print(0)
    quit()
for x in ls:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Solution (Python):
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)

Solution (Python):
N = int(input())
L1 =[int(i) for i in input().split()]
L2=sorted(L1)
if L2[0]==0:
    print(0)
elif L2[-1]*L2[-2]>10**18:
    print(-1)
else:
    ans=1
    for i in range(N):
        ans*=L2[i]
    if ans<=10**18:
        print(ans)
    else:
        print(-1)

Solution (Python):
import sys
n = int(input())
a_ls = list(map(int, input().split()))
ans = 1
if min(a_ls) != 0:
    for i in range(n):
        ans *= a_ls[i]
        if ans > 10**18:
            print(-1)
            sys.exit()
    if ans > 10**18:
        print(-1)
    else:
        print(ans)
else:
    print(0)

Solution (Python):
N = int(input())
a = [int(x) for x in input().split()]

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

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

Solution (Python):
str = int(input())
str2 = input()
str3 = str2.split(" ")
res = 1
isZero = False


for i in range(0, str):
    if 0 == int(str3[i]):
        isZero = True
        res = 0

if not isZero:
    for i in range(0, str):
        res *= int(str3[i])
        if res > 10 ** 18:
            res = -1
            break

    
print(res)

Solution (Python):
def main():
    n = int(input())
    nums = list(map(int, input().split()))
    s = set(nums)
    if 0 in s:
        print(0)
        return
    ans = 1
    bound = 10 ** 18
    for num in nums:
        ans *= num
        if ans > bound:
            print(-1)
            return
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
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")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
import sys
ans = 1
if 0 in a:
    print(0)
    sys.exit()
for i in a:
    if ans <= 1000000000000000000:
        ans = ans * i
      
    else:
        print(-1)
        sys.exit()
if ans <= 1000000000000000000:
    print(ans)
else:
    print(-1)

Solution (Python):
n = int(input())
n_list = [int(i) for i in input().split()]
ans = 1
n_list.sort()
n_list = list(reversed(n_list))
if 0 in n_list:
    print(0)
else:
    for i in n_list:
        ans *= i
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)

Solution (Python):
import numpy as np


def main(A):
    ans = 1
    for i in A:
        if i == 0:
            return 0
    for i in A:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
    return ans


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

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

a.sort()

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


print(ans)

Solution (Python):
n = int(input())
a = [] * n
ans = 1

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

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

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

Solution (Python):
from functools import reduce
from operator import mul

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

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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
flag = 0
b = 1

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

Solution (Python):
N=int(input())
A=list(map(int,input().split(' ')))
def mul(x):
    l=1
    if 0 in x:
        l=0
    else:   
        for i in x:
                l=l*i
                if l>10**18:
                    l=-1
                    break
    return l
print(mul(A))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
ans = 1


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

    
print(ans)

Solution (Python):
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 > 1e18:
        break

if ans > 1e18:
    print(-1)
else:
    print(ans)

Solution (Python):
n = int(input())
nums = list(map(int, input().split()))
ans = 1
ok = True
if(0 in nums):
    print(0)
else:
    for i in nums:
        ans *= i
        if(ans > int(1e18)):
            ok = False
            break
    if(not ok):
        print(-1)
    else:
        print(ans)

Solution (Python):



def product_many(N):
    if 0 in N: return 0
    ans = 1
    for x in N:
        if (10 ** 18 / ans) < x: return -1
        ans *= x
        if ans > 10 ** 18: return -1
    return ans

def main():
    _ = input()
    N = list(map(int, input().split()))
    print(product_many(N))

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
p = 1
if a.count(0):
    print(0)
    exit(0)
for i in range(n):
    p *= a[i]
    if p > int(1E18):
        print(-1)
        exit(0)
print(p)

Solution (Python):
N = int(input())

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

ans = 1

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

print(ans)

Solution (Python):
'''
    handle - pruvi007
    questionName - 
    Contest - 
    Topic - 
    Platform - 
'''
from sys import stdin, stdout
from collections import defaultdict

def main():
    n = int(stdin.readline())
    a = list(map(int,stdin.readline().split()))
    f = 1
    flag=0
    a = sorted(a)
    for i in range(n):
        f = f*a[i]
        if f>10**18:
            flag=1
            break
    if flag:
        print("-1")
    else:
        print(f)

main()

Solution (Python):
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)

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
A = list(map(int, stdin.readline().rstrip().split()))

result = 1
if 0 in A:
    print(0)
    exit()

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

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

a_sorted=sorted(a)
ans = 1

if a_sorted[len(a_sorted)-1] == 0:
  ans = 0
else:
  for i in range(len(a_sorted)):
    ans = ans * a_sorted[i]
    if ans > 1000000000000000000:
      ans = -1
      break

print(ans)

Solution (Python):
n=int(input())

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

ans=1

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

print(ans)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
a.sort()
b=1
if a[0]==0:
  print(0)
  exit()
for i in range(N):
  b=b*a[i]
  if b>10**18:
    print(-1)
    exit()
print(b)

Solution (Python):
n = int(input())
a = input().split()
for i in range(n):
    a[i] = int(a[i])
ans = 1
flg = False

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

Solution (Python):
def LI():
    return list(map(int, input().split()))

_ = int(input())
a = LI()
ans = 1
mod = pow(10, 18)

def main(ans):
    if 0 in a:
        ans = 0
    else:
        for i in a:
            ans *= i
            if ans > mod:
                ans = -1
                break
    print(ans)

if __name__ == "__main__":
    main(ans)

Solution (Python):
n = int(input())
ls = list(map(int,input().split()))
ans = 1
if 0 in ls:
    print(0)
else:
    for i in range(n):
        ans *= ls[i]
        if ans > 10 ** 18:
            print(-1)
            break
    if ans <= 10 ** 18:
        print(ans)

Solution (Python):
N = int(input())
X = list(map(int, input().split()))

x = 1

if min(X) == 0:
  print(0)
  x = -1
else:
  for i in range(N):
    x = x * X[i]
    if x > 10 ** 18:
      print(-1)
      x = -1
      break
    
if x > 0: print(x)

Solution (Python):

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

result = 1
a.sort(reverse=True)

if a[-1]==0:
    result = 0
else:
    for ai in a:
        result *= ai
        if result > MAX_RSESULT:
            result = -1
            break
print(result)

Solution (Python):
from functools import reduce
import operator

def f():
    input()
    s = input().split()

    if "0" in s:
        return 0

    ans = 1
    for num in map(int,s):
        ans *= num
        if ans > 10 ** 18:
            return -1
    return ans

print(f())