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):
a = int(input())
b = list(map(int,input().split()))
n = 1

c = 0
d = 0

for i in b:
    if i == 0:
        c += 1
    elif i > 10**18:
        d += 1
        
if c > 0:
    print(0)
    exit()
if d > 1 and c == 0:
    print(-1)
    exit()

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

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

if alist[0]==0:
  print(0)
  sys.exit(0)

answer=1
e18=10**18
for a in alist:
  answer*=a
  if answer>e18:
    print(-1)
    break
else:
  print(answer)

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())
num = 1
flag = 0
c=list(map(int, input().split()))
for i in c:
    if i == 0:
        flag = 1
        print("0")
if flag == 0:
    for i in c:
        num *= i
        if num > 1000000000000000000:
            print("-1")
            flag =1
            break
if flag == 0:

    print(num)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    limit = 10**18
    ans = 1
    for a in A:
        if limit % a != 0:
            if limit / a <= ans:
                ans = -1
                break
        else:
            if limit / a < ans:
                ans = -1
                break
        ans *= a
    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):
def fun():
	n = int(input())
	A = list(map(int,input().split()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod*=a
		if(prod>1000000000000000000):
			print(-1)
			return
	print(prod)
 
 
 
fun()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

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

    if A.count(0):
        print(0)
        return

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

Main()

Solution (Python):
N = int(input())
num = 1
flag = 0
c=[int(i) for i in input().split()]
for i in c:
    if i == 0:
        flag = 1
        print("0")
if flag == 0:
    for i in c:
        num *= i
        if num > 1000000000000000000:
            print("-1")
            flag =1
            break
if flag == 0:
    
    print(num)

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()
 
for i in range(n):
    
  ans *= a[i]
  if (ans > 1000000000000000000):
    print('-1')
    sys.exit()
  

print(ans)

Solution (Python):



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



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

Solution (Python):
def main():
    LIMIT = 10 ** 18

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

    mul = 1
    for x in A:
        mul *= x
        if mul > LIMIT:
            if any(x == 0 for x in A):
                print(0)
            else:
                print(-1)
            return
    print(mul)


if __name__ == '__main__':
    main()

Solution (Python):
def solve():
    n=int(input())
    a=list(map(int,input().split()))
    f=1
    if 0 in a:
        f=0
    for i in a:
        f*=i
        if f>1000000000000000000:
            print(-1)
            return 
    print(f)
solve()

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

Solution (Python):
import sys
import numpy as np
import functools
import operator
def II(): return int(input())
def LII(): return double(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    
    ans = 1
    A= LI()
    
    if A.count(0)>0:
        print(0)
    else:
        for i in range(N):
            ans = ans*int(A[i])
            if ans-1000000000000000000>0:
                print(-1)
                break


        if ans-1000000000000000000<=0:
            print(ans)
    


    


if __name__ == "__main__":
	main()

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

Solution (Python):
n = int(input())
num = list(map(int,input().split()))
num.sort()
if(num[0] == 0):
    print(0)
else:
    ans = 1
    f = 0
    for i in range(len(num)):
        ans *= num[i]
        if(ans >1000000000000000000):
            print(-1)
            f = 1
            break
    if(f == 0):
        print(ans)

Solution (Python):
N=int(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):
import numpy as np
from sys import stdin


def get_result(data):
    A = sorted(data[1])
    ans = 1
    for val in A:
        ans = ans * val
        if ans > 10**18:
            ans = -1
            break
        elif ans == 0:
            ans = 0
            break
    return ans


if __name__ == '__main__':
    raw_data = [val.rstrip() for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)

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

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

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

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 = m*a[i]
    if m>10**18:
        print(-1)
        sys.exit()

print(m)

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

ans = 1
flag = True
a = list(map(int, input().split()))

a.sort()

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

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

print(ans)

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

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

for b in a:
    if b:
        ans *= b
        if ans > pow(10, 18):
            ans = -1
            break
    else:
        ans = 0
        break

print(ans)

Solution (Python):

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

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

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

vt = 1

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

print(vt)

Solution (Python):
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
LIMIT = 10 ** 18
n=int(input())

a=[int(i) for i in input().split()]
if 0 in a:
	print(0)
	exit()

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
sum=1
flag=False
INF=1e18
for x in a:
    if(flag==False):
        sum*=x
    if(sum>INF):
        flag=True
if(0 in a):
    print(0)
elif(flag):
    print(-1)
else:
    print(sum)

Solution (Python):

from sys import stdin
from decimal import *
import numpy as np
input = stdin.readline
N = int(input())
A = list(map(Decimal,input().split()))
np_A = np.array(A)
ans = np_A[0]

zero_flag = False
if 0 in A:
    zero_flag = True

flag = True

for i in range(1, N, 1):
    ans = Decimal(ans)*Decimal(np_A[i])
    
    if ans > 10**18:
        flag = False
        break


if zero_flag == True:
    print(0)


else:
    if flag == False:
        print(-1)

    else:
        print(ans)

Solution (Python):
N = int(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, *A = map(int, open(0).read().split())
b = 1
A = sorted(A)
for a in A:
  if b > 10**18:
    break
  b *= a
print(-1 if b > 10**18 else b)

Solution (Python):



count = int(input())
num = []
num = input().split()

hantei = 0
for i in range(count):
    if int(num[i]) == 0:
        hantei = 1
        total = 0
    else:
        continue
      
      
if hantei == 0:
    total = 1
    for i in range(count):
        total = int(num[i])*total
        if total > 10**18:
            total = -1
            break
    
print(total)

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

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

answer = 1
if 0 in v:
  answer = 0
else:
  for i in v:
    answer = answer * i
    if answer <= limit:
      continue
    else:
      answer = -1
      break
print(answer)

Solution (Python):

import sys


def solve(N: int, A: "List[int]"):
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > int(1e18):
            print(-1)
            return
    print(prod)
    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):
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
LIMIT = 10 ** 18
n=int(input())

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

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

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



op = 1
p = list(map(int,input().split()))
p.sort()
for i in p:
    op = op*i

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

print(op)

Solution (Python):
while True:
	try:
		N=input()
	except:
		break
	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):
from collections import deque
n=int(input())
a=deque()
a=list(map(int,input().split()))
s=0
if a.count(0) == 0:
  s=1
  for i in range(n):
    l=a.pop()
    s=s*l      
  
    if len(str(s)) >= 19:
      if s == 10**18 and i==n-1:
        break
      s=-1
      break

    
print(s)

Solution (Python):
import sys
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
LIMIT = 10 ** 18
n=int(input())

a=[int(i) for i in input().split()]
if 0 in a:
	print(0)
	exit()

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()))
res = 1
a.sort()
for i in a:
    res *= i
    if res > 1000000000000000000:
        res = -1
        break
print(res)

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
res = 1
for i in range(N):
    if A[i] == 0:
        res = 0
    if res < 0:
        continue
    res *= A[i];
    if res > 1e+18:
        res = -1

print(res)

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

Solution (Python):
while True:
	try:
		N=input()
	except:
		break
	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):
N = int(input())
A_list = list(map(int,input().split()))
A_list.sort()

if A_list[0]==0:
    answer = 0
else:      
    answer = 1
    for a in A_list:
        answer *= a
        if len(str(answer-1)) > 18:
            answer = -1
            break
print(answer)

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

a = [*map(int, input().split())]
for e in a:
    if e == 0:
        print(0)
        exit(0)

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

print(ans)

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

INF = 10 ** 18 + 1
ans = 1
for e in a:
    ans *= e
    ans = min(ans, INF)

if ans == INF:
    ans = -1

print(ans)

Solution (Python):
N=input()
ls=[int(s) for s in input().split()]
ans=1
flag=1
for e in ls:
  ans*=e
  if ans>10**18:
    flag=0
    break
zeroflag=1
for e in ls:
  if e==0:
    zeroflag=0
if flag==1:
  print(ans)
else:
  print(-1*zeroflag)

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

Solution (Python):
def resolve():
    N = int(input())
    A = input().split()
    ans = 1
    if "0" in A:
        print(0)
    else:
        for i in A:
            ans = int(i) * ans
            if ans > 1e+18:
                print(-1)
                return
        else:
            print(ans)
        return
resolve()

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

if A_list[0]==0:
    answer = 0
else:      
    answer = 1
    for a in A_list:
        answer *= a
        if len(str(answer-1)) > 18:
            answer = -1
            break
print(answer)

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

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

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

ans = 1

for b in a:
    if b == 0:
        ans = 0
        break
    else:
        ans *= b
        if ans > pow(10, 18):
            ans = -1
            break

print(ans)

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


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

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

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

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

Solution (Python):

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18

    _mul = 1
    for a in A:
        _mul *= a
        if _mul > limit:
            _mul = limit+1

    if _mul > limit:
        print(-1)
    else:
        print(_mul)

if __name__ == "__main__":
    resolve()

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

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

ans = 1
for i in range(N):
    if(ans > 1e18 // A[i]):
        print(-1)
        exit()
    ans *= A[i]

print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
res = 1
a.sort()
for i in a:
    res *= i
    if res > 1000000000000000000:
        res = -1
        break
print(res)

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

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

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

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

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

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

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

ans = 1
flag = 0
a.sort()

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



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

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

Solution (Python):

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    limit = 10**18

    if 0 in A:
        print(0)
        return

    _mul = 1
    for a in A:
        _mul *= a
        if _mul > limit:
            print(-1)
            return

    print(_mul)

if __name__ == "__main__":
    resolve()

Solution (Python):
import sys

def main():
    n = int(input())
    a=sys.stdin.readline().rstrip().split()
    if '0' in a:
        print(0)
        return
    ans=1
 
    for i in a:
        ans=ans*int(i)
        if ans>1000000000000000000:
            print("-1")
            return
    else:
        print(ans)
main()

Solution (Python):
n,*a=map(int,open(0).read().split())
a.sort()
if a[0]==0:print(0);exit()
ans=1
for q in a:
  ans*=q
  if ans>10**18:print(-1);exit()
print(ans)

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

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

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

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

Solution (Python):

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

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

print(ans)

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

if 0 in A:
  ans=0
  print(0)
  
if ans:
  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() ) )
 
if 0 in A:
  print( 0 )
else:
  ret = 1
  for a in A:
    ret = ret * a
    if ret > 10 ** 18:
      ret = -1
      break
  print( ret )

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

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

total=1
for i in a:
    total *=i

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

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

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

else:
    print(ans)

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

print(ans)

Solution (Python):
n=int(input())
*a,=map(int, input().split())
if 0 in a:
    print(0)
    exit()

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

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

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

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

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

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

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

print(ans)

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = I()
A = LI()

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

s = 1
for i in range(N):
    s *= A[i]
    if s > 10**18:
        print('-1')
        exit()

print(s)

Solution (Python):
def main():    
    N = int(input())
    a = list(map(int,input().split()))
    res = 1
    if 0 in a:
        print(0)
        return
    for i in a:
        res *= i
        if res > 10**18:
            print(-1)
            return
    print(res)
if __name__ == "__main__":
    main()

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

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

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

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

ans = li[0]
for i,l in enumerate(li):
    if i == 0:
        continue
    else:
        
        ans *= l
        if ans > 10**18:
            print(-1)
            exit()
        
if ans > 10**18:
    print(-1)
else:
    print(ans)

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

x=10**18 
flag=0;
for i in a:
	if i==0:
		flag=1
		break

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

Solution (Python):
N = input()
listed = input().split()
mul = 1
for num in listed:
  num = int(num)
  if num == 0:
    mul = 0
    break
  if mul != -1:
    mul *= num
    if mul > 10**18:
      mul = -1
print(mul)

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

    if ans > 1000000000000000000:
      print("-1")
      ng = 1
      break
  if ng==0:
    print(ans)

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

Solution (Python):

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

for i in range(n):
    if An[i] == 0:
        print(0)
        quit()

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

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

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=list(map(int,input().split()))
 
if 0 in A:
    print(0)
else:
    result=1
    for a in A:
        result=result*a
        if result>10**18:
            result=-1
            break
    print(result)

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

if any([a == 0 for a in A]):
    print(0)
    exit()

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

print(ans)

Solution (Python):


import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def solve(N, A):
    for i in range(N):
        if A[i] == 0:
            print(0)
            return
    ans =1
    for i in range(N):
        if A[i] > math.pow(10,18):
            print(-1)
            return
        ans *= A[i]
        if ans > math.pow(10,18):
            print(-1)
            return
    print(ans)



def main():
    import sys
    tokens = iter(sys.stdin.read().split())
    N = int(next(tokens))
    A = [None for _ in range(N)]
    for i in range(N):
        A[i] = int(next(tokens))
    assert next(tokens, None) is None
    solve(N, A)

if __name__ == '__main__':
    main()

"""
cd ~/Desktop/Programming/AtCoder/contest/abc169/abc169_b && sh testp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc169/abc169_b && sh etest.sh
cd ~/Desktop/Programming/AtCoder/contest/abc169/abc169_b && sh submitp.sh
"""

Solution (Python):
N=int(input())
A=[*map(int,input().split())]
a=1
if 0 in A:
  a=0
else:
  while A:
    a*=A.pop()
    if a>10**18:
      a=-1
      break
print(a)

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

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 *= L[i]
  if ans > 10**18:
    print(-1)
    exit()
print(ans)

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

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

ans = 1

a.sort(reverse=True)

if 0 not in a:
    for x in range(n):
        ans *= a[x]

        if ans > 10**18:
            ans = -1
            break
else:
    ans = 0

print(ans)

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

if 0 in b:
  print(0)
  exit()
c=1
for i in b:
    c*=i
    if(c>10**18):
        print(-1)
        exit()
     
print(c)

Solution (Python):
N = int(input())
a = [ int(x) for x in input().split(" ")]
a.sort()
ans = 1
for x in a:
  if x==10**18 and ans>1:
    ans = -1
    break
  else:
    ans *= x
    if ans>10**18:
      ans = -1
      break
print(ans)

Solution (Python):

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

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

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

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

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

if b == 'out':
  print(-1)
else:
  print(b)

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

Solution (Python):

n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort()

ans = 1

for num in arr:
    ans *= num

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

print(ans)

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

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

Solution (Python):
import sys

N = int(input())
A = input().split()

if "0" in A:
    print(0)

else:
    ans = 1
        
    for n in range(N):
        ans = ans*int(A[n])

        if ans>10**18:
            print(-1)
            sys.exit()
            
    if ans<=10**18:
        print(ans)