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(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    
    N = [int(x) for x in sys.stdin.readline().split()][0]  
    
    a_list = [int(x) for x in sys.stdin.readline().split()]  

    
    
    
    

    b = 10**18

    if 0 in a_list:
        print(0)
        return

    a = 1
    for _a in a_list:
        a *= _a
        if a > b:
            print(-1)
            return

    print(a)


if __name__ == "__main__":
    resolve()





import sys
from io import StringIO
import unittest


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)

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

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

print(ans)

Solution (Python):
_ = input()
l = list(map(int, input().split()))
 
res = 1
for i in l:
    if i == 0:
        res *= i
        break
    if res == -1:
        continue
    res *= i
    if res > 1e18:
        res = -1
 
print(res)

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort()
cnt = 1
for i in a:
    cnt *= i
    if cnt > 10**18:
        print(-1)
        exit()
print(cnt)

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

Solution (Python):
import itertools
from functools import cmp_to_key
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = map(int, readline().split())
A = map(int, readline().split())
A = sorted(A)

ret = 1
for num in A:
    ret *= num
    if(ret > 1000000000000000000):
        print(-1)
        exit(0)
print(ret)
exit(0)

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

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

num = list(input().split())
ans = 1
if '0' in num :
    ans = 0
else:
    for i in num:
        ans *= int(i)
        if ans  > 10**18:
            break

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

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

Solution (Python):
n = int(input())
k = list(map(int, input().split()))
import collections
c = collections.Counter(k)
re = 1
if c[0] == 0:
  for i in range(n):
    re = re * k[i]
    if re > 10**18:
      print(-1)
      exit()
  print(re)
else:
  print(0)

Solution (Python):
N = int(input())
A = sorted(list(map(int, input().split())), reverse = True)
if 0 in A:
    print(0)
else:
    val = 1
    for a in A:
        val *= a
        if val > 10**18:
            val = -1
            break
    print(val)

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

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

ans = 1
if 0 in c:
    print('0')
    exit()

for i in range(n):
    ans *= c[i]
    if ans > 1000000000000000000:
        print('-1')
        exit()

print(ans)

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

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

ans = 1

p = 10 ** 18

for a in A_list:
    ans *= a
    if ans > p:
        ans = -1
        break

if 0 in A_list:
    print(0)
else:
    print(ans)

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

ans = 1
flag = False
A.sort()
for i in range(N):
  ans *= A[i]
  if(ans>1000000000000000000):
    flag = True
    break

if(flag):
  print(-1)
else:
  print(ans)

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

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

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

print(num)

Solution (Python):
n=int(input())
a=sorted(list(map(int, input().split())))
ans=1
f=True
for i in a:
    ans*=i
    if ans>10**18:
        f=False
        break
if f:
    print(ans)
else:
    print(-1)

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

result = 1
hantei = True
zero = False
if 0 in L:
    zero = True
else:
    for i in L:
        result *= i
        if result > 10**18:
            hantei = False
            break
if zero:
    print(0)
elif hantei:
    print(result)
else:
    print("-1")

Solution (Python):
from sys import exit
N = int(input())
A = list(map(int, input().split()))
ans = 1
A.sort(reverse=True)
if A[-1] == 0:
  print(0)
  exit()
for a in A:
  ans *= a
  if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

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

if 0 in A:
    print(0)
else:
    A.sort()
    A.reverse()

    i = 1
    res = A[0]
    while (res <= (10 ** 18)) and (i < len(A)):
        res = res * A[i]
        i += 1
    if res <= (10 ** 18):
        print(res)
    else:
        print("-1")

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



cum=1
p=A.count(0)

if p>0:
  cum=0

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

print(cum)

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

if A.count(0) > 0:
    print(0)
else:
    ans = A[0]
    for i in range(1, 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()))
if a.count(0) > 0:
  ans = 0
else:
  ans = 1

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

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

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

strs = input().split()
sum = 1
out_range = False
for i in range(n):
  v = int(strs[i])
  if(not out_range):
    sum *= v
    if(sum > 1000000000000000000):
      out_range = True

  if(v == 0):
    print(0)
    sys.exit()
    
if(not out_range):
  print(sum)
else:
  print(-1)

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

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

ans=1
for v in a:
	ans*=v
	if 1000000000000000000 < ans:
		ans = -1
		break
if any([v==0 for v in a]):
	ans=0
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

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

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

ans=1
for i in range(n):

    if ans>10**18:
        print(-1)
        exit()
    else:
        ans*=a[i]

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

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

Solution (Python):
import sys
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    if 0 in a:
        print('0')
        return
    ans = 1
    for hoge in a:
        ans *= hoge
        if ans > 10**18:
            print('-1')
            return
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin, stdout

N = int(input())
A = [int(x) for x in stdin.readline().split()]
ans = 1
for i in range(N):
  if ans <= 1e18:
    ans *= A[i]
  if A[i] == 0:
    ans *= A[i]

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

Solution (Python):
from functools import reduce
n=int(input())
a = tuple(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
    if ans > pow(10,18):
        ans = pow(10,18)+1

print(ans if ans <= pow(10,18) else -1)

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

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

ans = 1
for a in A:
    ans *= a
    if(ans > 1000000000000000000) :
        print(-1)
        sys.exit()
print(ans)

Solution (Python):
N = int(input())
K = [int(i) for i in input().split()]

if K.count(0) > 0:
    print(0)
else:
    ans = 1
    burst = False
    for k in K:
        ans *= k
        if ans > 10**18:
            burst = True
            break
    if burst:
        print(-1)
    else:
        print(ans)

Solution (Python):
import sys

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

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

maxi = int(1e18)

ans = 1
for x in a:
    ans *= x
    if ans > maxi:
        ans = -1
        break

print(ans)

Solution (Python):
def main():
    n = int(input())
    a = tuple(map(int, input().split()))

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

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

    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    paramN = input()
    params = list(map(lambda x: int(x), input().split(' ')))
    if len(list(filter(lambda x: x == 0, params))) > 0:
        print(0)
    else:
        result = 1
        for p in params:
            result *= p
            if result > pow(10, 18):
                print(-1)
                return
        print(result)

main()

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

res = 1
flag = True
if 0 in A:
    print(0)
else:
    for i in range(len(A)):
        res = res * A[i]
        if res > mod:
            flag = False
            break
    if flag:
        print(res)
    else:
        print(-1)

Solution (Python):
n=int(input())
alist=list(map(int,input().split()))
import math
mini=min(alist)
if mini==0:
    ans=0
else:
    ans=1
    for i in range(n):
        ans*=alist[i]
        if ans>pow(10,18):
            ans=-1
            break


print(ans)

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

MAX = 10**18


def main():
    for a in A:
        if a == 0:
            print(0)
            return
    total = 1
    for a in A:
        total *= a
        if total > MAX:
            print(-1)
            return

    print(total)


main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse = True)
ans = 1
if a[-1] == 0:
    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())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if a[-1] == 0:
  ans = 0
else:
  for i in a:
    ans *= i
    if ans > 1000000000000000000:
      print(-1)
      break
    else:
      continue

if ans <= 1000000000000000000:
  print(ans)

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

Solution (Python):
count = int(input())
numbers = list(map(int, input().split(' ')))

result = 1 

if 0 in numbers:
  result = 0
else:
  for num in numbers:
    result *= num
    if result > 10**18:
      result = -1
      break

print(result)

Solution (Python):
def main():
  N = int(input())
  A = [int(i) for i in input().split()]
  A.sort()
  res = 1
  for i in range(N):
    res = res * A[i]
    if res == 0:
      print(res)
      return
    elif res > 10 ** 18:
      print(-1)
      return
  if res > 10 ** 18:
    print(-1)
  else:
    print(res)

if __name__ == "__main__":
  main()

Solution (Python):
def main():
	N = int(input())
	arr = list(map(int, input().split()))
	ans = arr[0]
	if arr.count(0) > 0:
		print(0)
		return
	for i in range(1, N):
		ans *= arr[i]
		if ans > 1000000000000000000:
			print(-1)
			return
	print(ans)


if __name__ == '__main__':
	main()

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

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

def solve():
    for i in range(N):
        if A[i] == 0:
            print(0)
            return
        
    ans = 1
        
    for i in range(N):
        ans *= A[i]
        if ans > INF:
            print("-1")
            return
    print(int(ans))
        
solve()

Solution (Python):
import sys
N=int(input())
s = list(map(int, input().split()))
ans =1
for i in s:
    if i==0:
        print(0)
        sys.exit()
    
for i in s:
    ans*=i
    if ans>1e18:
        print(-1)
        sys.exit()

print(ans)

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

def intinp():
    return int(input())

N = intinp()
A = list(mapint_inp())

lim = 10**18
ans = 1
f = True
if 0 in A:
    ans = 0
else:
    for A_i in A:
        ans = ans*A_i
        if ans > lim:
            f = False
            break

if f:
    print(ans)
else:
    print(-1)

Solution (Python):
from decimal import Decimal

n = int(input())
xs = [int(x) for x in input().split()]

p = Decimal(1)

bad = False

for x in xs:
	if bad:
		if x == 0:
			p = 0
			break
	else:
		p *= Decimal(x)
		if p > 10**18 :
			bad = True
			p = -1

print(p)

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

Solution (Python):
import math
from collections import deque
from collections import defaultdict



def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))


n = readInt()
a = readInts()

ans = 1

d = defaultdict(int)

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

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

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

else:
	print(ans)

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

ans = 1

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

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
answer = 1
if 0 in A:
    print(0)
    exit()

for i in range(len(A)):
    if len(str(answer)) + len(str(A[i])) <= 20:
        answer *= A[i]
    else:
        print(-1)
        exit()

if answer <= 1000000000000000000:
    print(answer)
else:
    print(-1)

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

result=1

for i in A:
    if i == 0:
        result=0
        break

if result != 0:
    for i in A:
        result = result * i
        if result > max_result:
            result = -1
            break
    
print(result)

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

a = [0] * n

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

sum = 1
cnt = 0
if 0 in a:
    print(0)
else:
    for i in a:
        sum *= i
        if sum > 1000000000000000000:
            print(-1)
            cnt = 1
            break
    if cnt == 0:
        print(sum)

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

Solution (Python):
from sys import stdin

n = int(stdin.readline().strip())
seq = list(map(int, stdin.readline().split()))

mul = 0
if 0 not in seq:
  mul = 1
  for k in seq:
    mul *= k
    if mul>int(1e18):
      mul = -1
      break
print(mul)

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline
 
n = int(input())
l = list(map(int,input().split()))

if 0 in l:print(0);exit()

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

print(ans)

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

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

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

print(ans)

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

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

Solution (Python):
import sys

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

answer = 1

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


print(answer)

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

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

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

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

Solution (Python):
import sys

N = int(input())


A = input().split()


L = [int(b.strip()) for b in A]


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

ret = 1
for v in L:
  ret = ret * v
  if ret > 1000000000000000000:
    print(-1)
    sys.exit()

print(ret)

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

res = 1
for x in a:
	if res == 0 or res == -1:
		break
	res = res * x
	if res > 1000000000000000000:
		res = -1

print(res)

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

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

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

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

kekka=1

for i in range(N):
    kekka*=A[i]
    if kekka>10**18:
        kekka=10**18+1

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


print(kekka)

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

Solution (Python):
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    if 0 in A:
        print(0)
        return

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

    print(ans)

main()

Solution (Python):
INF = 1000000000000000000
N = int(input())
flag = 1
l = list(map(int,input().split()))
if 0 in l:
  print(0)
  import sys
  sys.exit()
sum = 1
for i in l:
  sum = sum*i
  if sum > INF:
    print(-1)
    flag = 0
    break
  else:
    pass
    
if flag:
  print(sum)

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

A = input().split()
result = 1

A.sort()
fl = True

if int(A[0]) == 0:
    print(0)
else:
    for i in A:
        result *= int(i)
        if result > 10**18:
            fl = False   
            break                
    if fl:
        print(result)
    else:
        print(-1)

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 1
if (0 in a):
    ans = 0
else:
    for i in a:
        if i <= 1e18:
            t = ans * i
            if t <= 1e18:
                ans = t
            else:
                ans = -1
                break
        else:
            ans = -1
            break
print(ans)

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

'''

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

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

Solution (Python):
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    input()
    A = read_list()
    if 0 in A:
        print(0)
        return

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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
import sys
tmp = 1
A.sort(reverse = True)
if 0 in A:
    print(0)
else:
    for i in range(N):
        tmp *= A[i]
        if tmp > 10**18:
            print(-1)
            sys.exit()
    print(tmp)

Solution (Python):
from sys import exit
N = int(input())
A = list(map(int,input().split()))
ans = 1
if 0 in A: print(0)
else:
    for i in A:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            exit()
    print(ans)

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

limit = 1000000000000000000

sum = 1
for i in range(N):
    if (limit < sum or sum == -1):
        sum = -1
    else:
        sum *= AB[i]
    if (AB[i] == 0):
        print(0)
        exit()

if (limit < sum):
    sum = -1

print(sum)

Solution (Python):

import sys

def solve(N: int, A: "List[int]"):
    A.sort()
    ans =1
    for a in A:
        ans = ans * a

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



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, A)

if __name__ == '__main__':
    main()

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

print(ans)

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

if 0 in A:
  s=0
else:
  for a in A:
    s*=a
    if s>10**18:
      s=-1
      break
print(s)

Solution (Python):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    
    if ans>10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)

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

if inputs.count(0) >= 1:
    multiple = 0
    
else:
    for i in range(N):
        if i == 0:
            multiple = inputs[0]
        else:
            multiple *= inputs[i]

        if multiple > 10**18:
            multiple = '-1'
            break

print(multiple)

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

ans = a[0]

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

Solution (Python):
import sys

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

ans = 1
for i in range(N):
    if A[i] == 0:
        print(0)
        sys.exit(0)

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
res = 1
for i in A:
    res *= i
    if res > 10**18:
        res = -1
        break
if A.count(0) != 0:
    res = 0
print(res)

Solution (Python):
N = int(input())
A = [int(p) for p in input().split()]
Result = 1

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

for i in A:
    Result = Result*i
    if(Result > 10**18):
        Result = -1
        break

print(Result)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
r = 1
x = 10**18
for i in a:
    r *= i
    if r > x:
        r = -1
        break
print(r)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans = 1
flg = 0
max = 10 ** 18 + 1

for i in range(n):
    if a[i] == 0:
        ans = 0
        break
    if flg == 0:
        ans = ans * a[i]
    if ans // max > 0:
        ans = -1
        flg = 1

if flg != 0 and ans != 0:
    ans = -1

print(ans)

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

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

printed = False
if 0 in a:
    print(0)
    printed = True

ans = 1

for x in a:
    ans *= x
    if ans > 1e18:
        if not printed:
            print(-1)
            printed = True
        break    
    
if not printed:
    print(ans)

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

mul = 1

A.sort()

for i in range(N):
  mul *= A[i]
  if mul == 0 or mul > 10 ** 18:
    break

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

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

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

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

res=1
for x in A:
	res*=x
	if res>pow(10,18):
		print('-1')
		exit()

else:
	print(res)

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

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

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

ans = 1

if 0 in a:
    ans = 0
else:
    for i in a:
        if ans <= 10**18:
            ans = ans * i
        else:
            break

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

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

ans = 1

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

        if i == N - 1:
            print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
l.sort()
if l[0]==0:
    print(0)
    exit(0)
ans=1
for i in l:
    ans*=i
    if ans>1000000000000000000:
        print(-1)
        exit(0)
print(ans)

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

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

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

ans = 1

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

Solution (Python):


from sys import stdin
input = lambda: stdin.readline().rstrip()

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

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

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

print(answer)

Solution (Python):
n = input()
list = [int(x) for x in input().split(" ")]
result = 1
if 0 in list:
    print(0)
else:
    for i in range(len(list)):
        result = result*list[i]
        if result > 10**18:
            result = -1
            break
    print(result)

Solution (Python):
import sys
n = input()
list_num =list(map(int,input().split()))
output = 1
if 0 in list_num:
    print(0)
    sys.exit()
for i in list_num:
    output = output * i
    if output > 10 ** 18:
        print(-1)
        sys.exit()
print(output)

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

def dfs(l, r):

    if l==r:
        return A[l]
    mid = (l+r)//2
    ans = 1
    ans = ans * dfs(l, mid)
    ans = ans * dfs(mid+1, r)
    return ans

ans = dfs(0, len(A)-1)

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

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

print(ans)

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

A.sort()
sum = 1
for a in A:
    sum *= a
    if sum > (10 ** 18):
        sum = -1
        break
print(sum)