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):
n = int(input())
a = list(map(int, input().split()))
c = 1
mul = 1
if 0 in a:
    print(0)
    c = 0
else:
    for i in range(n):
        mul *= a[i]
        if mul > 10**18:
            c = 0
            print('-1')
            break
if c == 1:
    print(mul)

Solution (Python):
from sys import exit

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

Solution (Python):
n = int(input())
ans = 1
A = list(map(int,input().split()))
A.sort()
if A[0] == 0:
    print(0)
    exit()
elif A[-1]*A[-2] > 10**18:
    print(-1)
    exit()
from collections import defaultdict
d = defaultdict(int)
for a in A:
    d[a] += 1
for k in d:
    ans *= k**d[k]
if ans > 10**18:
    print(-1)
else:
    print(ans)

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

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

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

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

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

print(result)

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()
    num_list = i_list()

    zero_c = num_list.count(0)

    if zero_c >= 1:
        print(0)
        exit()

    ans = 1

    max_num = 10**18

    for num in num_list:
        ans *= num
        if ans > max_num:
            print(-1)
            exit()

    print(ans)
            
if __name__ == '__main__':
    main()

Solution (Python):
def resolve():
    import sys
    input = sys.stdin.readline
    
    n = int(input())
    
    
    
    
    
    A = list(map(int, input().split()))
    
    

    A = sorted(A)
    cnt = 1
    flag = True
    for i in range(n):
        cnt *= A[i]
        
        if cnt > 10**18:
            flag = False
            break

    if flag == True:
        print(cnt)
    else:
        print(-1)


resolve()

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

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

ans = 1
for num in nums:
    ans = ans*num 
    if ans > MAX:
        print(-1)
        exit()

print(ans)

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

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

e = 10**18
ans = a[0]
if 0 in a:
    print(0)
    exit()

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

Solution (Python):

n = int(input())
th = pow(10, 18)
a = list(map(int, input().split()))

ans = 1
over = False

for i in a:
    ans *= i
    if ans > th:
        over = True
        ans %= th
    
    if i == 0:
        ans = 0
        over = False
        break

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

Solution (Python):
x=int(input())
s=list(map(int,input().split()))
s.sort()
res=1
for n in s:
	res*=n
	
	if res>1e18:
		res=-1
		print(-1)
		exit(0)
print(res)

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

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

if 0 in A:
    a = 0
else:
    A = sorted(A)
    for i in A:
        if 10**18 <i*a:
            a = -1
            break 
        else:
            a = i*a
print(a)

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

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

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

print(val)

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

    if 0 in a:
        ans = 0

    print (ans)



if __name__ == "__main__":
    main()

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

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

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

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

isZero = False
for l in L:
    if (l == 0):
        isZero = True

if (isZero):
    print(0)
else:
    a = 1
    maxV = 1e+18
    for l in L:
        a *= l
        if (a > maxV):
            print(-1)
            sys.exit()

    print(a)

Solution (Python):

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

limit = pow(10, 18)
N, *A = map(int, read().split())
A = sorted(A)

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

print(ans)

Solution (Python):
import sys
N = int(input())
A = list(map(int, input().split()))
if min(A) == 0:
    print(0)
    sys.exit(0)

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

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

Solution (Python):
import sys

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

l = 10**18

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

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

print(ans)

Solution (Python):
import sys 

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

if min(A)==0:
  print("0")
  sys.exit()
if max(A) > 10**18:
  print("-1")
  sys.exit()

ans = 1
for i in range(0,N):
  ans = ans*int(A[i])
  if ans > 10**18:
    print("-1")
    sys.exit()

print(ans)

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

Solution (Python):
N = int(input())
max_ans = 10**18

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

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

print(ans)

Solution (Python):

n = int(input())
l = list(map(int,input().split()))
l = sorted(l)

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

Solution (Python):
import sys

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

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

res = 1
for v in a:
    res *= v
    if res > 10 ** 18:
        print(-1)
        sys.exit()

print(res)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

U = 10 ** 18
p = 1
for x in A:
    p *= x
    if p > U:
        p = U + 1

if p > U:
    print(-1)
else:
    print(p)

Solution (Python):
import sys
n=int(input())
A = [int(x) for x in input().split()]
bar = 10**18
ans =A[0]
if 0 in A:
    print(0)
    sys.exit()
    
for i in A[1:]:
    ans = ans * i
    if ans > bar:
        print(-1)
        sys.exit()
        
print(ans)

Solution (Python):

N = int(input())
A = list(map(int,input().split()))
ans =1
A.sort()
for i in A:
    if i == 0 :
        ans = 0
        break
    ans *= i 
    if ans >10**18:
        print(-1)
        exit()
print(ans)

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

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

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

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

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

LIMIT = 10 ** 18
result = 1


for a_i in sorted(list(a_n)):
    result = result * a_i

    if result > LIMIT:
        result = -1
        break
print(result)

Solution (Python):
n = int(input())
A = sorted(list(map(int, input().split())))
ans = A[0]
for i in range(1, n):
    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)
else:
  for i in range(n):
    ans=ans*a[i]
    if ans>10**18:
      print(-1)
      break
  else:
    print(ans)

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

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

maxn = 10**18
ans = 1
for k in a:
    ans *= k
    if ans > maxn:
        ans = -1
        break


print(ans)

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

s = 1
l=10**18

for i in a:
    s *= i
    if s > l:
        print(-1)
        exit()
print(s)

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

Solution (Python):

n = int(input())
a = list(map(int, input().split()))
upper = 10 ** 18
res = 1

a.sort()
a.reverse()

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

for aa in a:
    res *= aa
    if res > upper:
        print(-1)
        exit(0)

print(res)

Solution (Python):


iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = list(iim())
    mx = 10**18
    A.sort()

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

    ans = 1
    for i, a in enumerate(A):
        ans *= a
        if ans > mx:
            print(-1)
            return

    print(ans)

if __name__ == "__main__":
    resolve()

Solution (Python):
N = int(input())
A = sorted(map(int, input().split()))
if A[0] == 0:
    print(0)
    exit()

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

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

Solution (Python):
import sys

N = int(sys.stdin.readline().rstrip())


A = list(map(int, sys.stdin.readline().rstrip().split()))

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

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

Solution (Python):
n, *A = map(int, open(0).read().split())
A.sort()
s = 1
for a in A:
    s *= a
    if s > 10**18:
        print(-1)
        break
    elif s == 0:
        print(0)
        break
else:
    print(s)

Solution (Python):


import math
import re
import numpy as np

N = int(input())
An = input().split(" ")

over = False

ans = 1

if "0" in An:
    ans = 0

else:
    for i in range(N):
        Ai = int(An[i])
        if (ans != 0 and Ai > 1000000000000000000) or ans > 1000000000000000000:
            over = True
            break

        ans *= Ai

if ans > 1000000000000000000:
    over = True

if not over:
    print(ans)
else:
    print(-1)

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

tot=A[0]
b=True
if (0 in A)==True:
    print(0)
    b=False
a=True
if b==True:
    for i in range(1,N):
        tot=tot*A[i]
        if tot>10**18:
            print(-1)
            a=False
            break
    if a==True:
        print(tot)

Solution (Python):
def d():
    N= input()
    A = list(map(int,input().split()))
    if(0 in A):
        return 0
    p=1
    for a in A:
        p*=a
        if(p>10**18):
            return '-1'
    return p
print(d())

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 > 1000000000000000000:
        print(-1)
        exit()
print(ans)

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

l = []
ans = 1
z = False
l = input().split(' ')
for x in l:
  x = int(x)
  if x == 0:
    print(0)
    exit(0)
for i in range(n):
  x = int(l[i])
  ans *= x
  if ans > 1e18:
    ans = -1
    break

print(ans)

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

Solution (Python):
N = int(input().strip())
array = list(map(int, input().strip().split()))
x=1
l=len(array)
a=array.count(0)
if a>=1:
    print(0)
else:
    for i in range (l):
        x*=array[i]
        if x>1000000000000000000:
            x=-1
            break
    print(x)

Solution (Python):

def submit():
    n = int(input())
    a = [int(e) for e in input().split()]
    thr = 10 ** 18

    if 0 in a:
        print(0)
        return

    ans = 1
    for e in a:
        ans *= e
        if ans > thr:
            ans = -1
            break
    
    print(ans)


submit()

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

Solution (Python):
a = int(input())
b = [int(x) for x in input().split()]
summ = 1
for i in range(a):
    if(b[i]==0):
        summ = 0
for i in range(a):
    summ*=b[i]
    if(summ>1000000000000000000):
        summ=-1
        break
print(summ)

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

ans = 1

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

Solution (Python):
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()
a = LIST()
res  = 1
if 0 in a:
    print(0)
    sys.exit()

for i in range(n):
    res *= a[i]
    if res > 10**18:
        print(-1)
        sys.exit()
print(res)

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 *= A[i]
    if ans <= 10**18:
      continue
    else:
      ans = -1
      break
  print(ans)

Solution (Python):
import collections

N=int(input())
list = list(map(int, input().split()))
c = collections.Counter(list)
m=10**18

if(c[0]!=0):
  print(0)
else:
  i=0
  res=1
  while(i<N):
    res=res*list[i]
    if(m<res):
      res=-1
      break
    i+=1
  print(res)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 1
a.sort()
for e in a:
    if ans > 1000000000000000000:
        break
    else:
        ans *= e 

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

Solution (Python):
import sys
import math

N=int(input())

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


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

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

print(mult)

Solution (Python):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = list(map(int, input().split()))

    if 0 in A:
        print(0)
        return

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


main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
t=1
for m in a:
    t*=m
    if t > 1000000000000000000:
        t=-1
    elif t == 0:
        t=0
        break
    elif t<0:
        t=-1
print(t)

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())
a = list(map(int, input().split()))
a.sort()
res = 1
for i in range(n):
	res *= a[i]
	if res > 1e18:
		print(-1)
		exit(0)
print(res)

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



print(b)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

a.sort(reverse=True)


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

    for i in a:
        m *= i
        if m > 10 ** 18:
            break

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

Solution (Python):
import sys




def solve():
    res = 1
    over = False
    for i in range(len(a)):
        if not over:
            res *= a[i]
            if res > mxn:
                over = True
        else:
            if a[i] == 0:
                print(0)
                return
    if not over:
        print(res)
    else:
        print(-1)
    return


mxn = 10**18
n = int(input())
a = [int(i) for i in input().split()]
solve()

Solution (Python):
def main():
    n, *a = map(int, open(0).read().split())
    ans = 1
    if a.count(0):
        print(0)
        exit()
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            break
    else:
        print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

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

ans = 1
lim = pow(10, 18)

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

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

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

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

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

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

n = 1
lim = 10**18
for e in l:
    n *= e
    if n > lim:
        print(0 if 0 in l else -1)
        break
else:
    print(n)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 1
x_min = min(a)
if x_min == 0:
    print(0)
else:
    for x in a:
        ans *= x
        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:
    print(0)
    exit()

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

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 > 10**18:
        print(-1)
        exit()
        
print(ans)

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

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

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

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

else:
    print(ans)

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

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

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

s = 1
for a in A:

    s *= a
    if s > 10 ** 18:
        print('-1')
        exit()
print(s)

Solution (Python):
def main() :

    N = int(input())
    N_list = [int(i) for i in input().split()]
    res = 1

    if (N_list.count(0) > 0) :
        print(0)
        return

    for i in range(len(N_list)) :
        res = res * N_list[i]
        if (res > 1000000000000000000) :
            print(-1)
            return
    
    print(res)

main()

Solution (Python):
n, *a = map(int, open(0).read().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())
a = [int(_) for _ in input().split(' ')]

if any([i == 0 for i in a]):
    print(0)
else:
    ans = a[0]
    for i in range(n - 1):
        ans *= a[i + 1]
        if ans > int(1e18):
            break

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

Solution (Python):


flag = 0
ans = 1
n = int(input())
num_list = list(map(int, input().split()))
for num in num_list:
    if num == 0:
        ans = 0
        
for num in num_list:
    ans = ans*num

    if ans > 1000000000000000000:
        print(-1)
        flag = 1
        break;
if flag == 0:
    print(ans)

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
m = 1
flag = True
try:
    a = A.index(0)
    print(0)
except:

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

    if flag:
        print(m)

Solution (Python):
N = int(input())
A = input().split()
result = 1
max_val = 10**18
for a in A:
    if a == '0':
        print(0)
        exit()
for a in A:
    result *= int(a)
    if result > max_val:
        print(-1)
        exit()
print(result)

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

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = int(input())
A = readInts()
ans = 1
if A.count(0):
    print(0)
    exit()
A = sorted(A)
for i in range(n-1,-1,-1):
    ans *= A[i]
    
    if ans > 10**18:
        print(-1)
        exit()
    if ans == 0:
        print(0)
        exit()
print(ans)

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

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

Solution (Python):
import sys
from functools import lru_cache
 

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**6)
def read():
  return int(readline())
def reads():
  return map(int, readline().split())
def mp(arg):
  return map(int,arg.split())
n=read()
res=1
mod=10**18
a=list(reads())
if 0 in a:
  print("0")
  exit()
for i in range(n):   
    res*=a[i]
    
    if res>mod:
        print("-1")
        exit()
print(res)

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

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

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

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Solution (Python):
N = int(input())
arr = [int(x) for x in input().split()]
found = False
for x in arr:
  if x == 0:
    found = True
if found:
  print(0)
  exit(0)
res = 1
MAX = 10 ** 18
for x in arr:
  res *= x
  if res > MAX:
    print(-1)
    exit(0)
print(res)

Solution (Python):
n = int(input())
ans = 1
l = list(map(int, input().split()))
if 0 in l:
    print(0)
    exit(0)

for x in l:
    ans *= x

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

print(ans)

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

Solution (Python):
def main():
    max_lim = 10 ** 18
    _ = int(input())
    A = [int(x) for x in input().split()]
    now = A[0]
    for a in A[1:]:
        if now != -1:
            now *= a
        if a == 0:
            print(0)
            return
        if now > max_lim:
            now = -1
    print(now)

if __name__ == "__main__":
    main()

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

Solution (Python):

import collections
import itertools as it
import math

 

n  = int(input())

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




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

ans = a[0]
for a_ in a[1:]:
    if ans * a_ <= 10 ** 18:
        ans *= a_
    else:
        print(-1)
        break
else:
    print(ans)

Solution (Python):
import sys







n = int(input())

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




a = sorted(a)
ans = a[0]

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

print(ans)

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 1
ju = 0
j = 0
if 0 in a:
    ju=1

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

if ju==1:
    print(0)
elif j==1:
    print(-1)
else:
    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 range(N):
    ans *= A[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
ans = 1
if min(A) == 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())
l=list(map(int, input().split()))
m=1
for i in range(n):
    m*=l[i]
    if m>10**18:
        if 0 in l:
            print(0)
            exit()
        print(-1)
        exit()

print(m)