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):
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

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

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



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

Solution (Python):

import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys


buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ans = 1
    l = 10**18
    A.sort()
    for a in A:
        ans *= a
        if ans > l:
            return -1
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

print(base)

Solution (Python):
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a=lmp()
ans=1
c=a.count(0)
if c>0:
    print(0)
    exit()
for i in range(n):
    ans*=a[i]
    if ans>10**18:
        print(-1)
        exit()
print(ans)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    if 0 in A: print(0)
    else:
        ans = 1
        for i, a in enumerate(A):
            ans *= a
            if ans > 10 ** 18:
                print(-1)
                break
        else:
            print(ans)
        

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul

mod = 10 ** 9 + 7
INF = 10 ** 13
sys.setrecursionlimit(2147483647)
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n = I()
A = LI()
ret = 1
for i in range(n):
    if A[i] == 0:
        print(0)
        exit()

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

print(ret)

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()

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):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    MAX = int(1e18)
    ans = 1
    for a in A:
        ans *= a
        if ans > MAX:
            print(-1)
            return
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)








n=n0()
A=n1()

A.sort()

ans=1
for a in A:
    ans*=a
    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 a in A:
    ans *= a
    if ans > 10 ** 18:
        print("-1")
        exit()
print(ans)

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

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

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

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)

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

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

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

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

print(ans)

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

MAX = 10**18
ans = 1

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

print(ans)

Solution (Python):
def main():
    n = int(input())
    a =list(map(int,input().split()))
    ans = 1
    tmp = 10 ** 18
    a.sort()
    for i, aa in enumerate(a):
        ans *= aa
        if ans > tmp:
            print(-1)
            return
    print(ans)
if __name__=='__main__':
    main()

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:
            print(-1)
            break
    else:
        print(ans)

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

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:
        ans = -1
        break

print(ans)

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

Solution (Python):

import sys


def solve(N: int, A: "List[int]"):
    tmp = 1
    th = 10 ** 18
    if 0 in A:
        return 0
    for a in A:
        tmp *= a
        if tmp > th:
            return -1
    return tmp



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)]  
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
lst1 = list(map(int,readline().split()))

INF = 10**18
if 0 in lst1:
    print(0)
    exit()
ans = 1
for i in range(n):
    ans *= lst1[i]
    if ans > INF:
        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 :
  ret = 1
  for i in range(N) :
    ret *= A[i]
    if ret > 10 ** 18 :
      print(-1)
      break
  else :
    print(ret)

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

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

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

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

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    ans = 1
    for ai in a:
        ans *= ai
        if ans > 10 ** 18:
            print(-1)
            exit()
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):









def solve():
    N = int(input())
    As = list(map(int, input().split()))

    if 0 in As:
        return 0

    ans = 1
    for a in As:
        ans *= a
        if ans > 10 ** 18:
            return -1

    return ans


def main():
    print(solve())


if __name__ == "__main__":
    main()

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

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

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


main()

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

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

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


ans=1
for i in A:
    ans*=i
    if ans>M:
        ans=-1
        break

print(ans)

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

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

print(ans)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    a = 1
    m = 10**18
    A.sort()
    for i in A:
        a *= i
        if a > 10**18:
            return -1
        elif a == 0:
            return 0
    return a
print(main())

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

ans = 1
for i in range(n):
    if a[i] == 0:
        ans = 0

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

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

Solution (Python):
N = int(input())
A_li = sorted(list(map(int,input().split())))
ans = 1
for i in A_li:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

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

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

Solution (Python):
import sys
input = sys.stdin.readline

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

INF = 10**18

if 0 in A:
    ans = 0
else:
    ans = 1
    for a in A:
        ans *= a
        if ans > INF:
            ans = -1
            break
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 sys
input = sys.stdin.readline

n = int(input())
a = [int(item) for item in input().split()]
if 0 in a:
    print(0)
    exit()
ans = 1
for item in a:
    ans *= item
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

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

Solution (Python):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

res = 1
n = ni()
a = nl()
a.sort()
for x in a:
    res *= x
    if res > 10**18:
        print(-1)
        exit()
print(res)

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

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

Solution (Python):

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

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()
  l.sort()

  ans=l[0]
  for x in l[1:]:
    ans*=x

    if ans>10**18:
      return -1

  return ans


print(main())

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

Solution (Python):

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

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

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

print(result)

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 18

def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 1
    if 0 in A:
        print(0)
        return
    for i in range(N):
        ans *= A[i]
        if ans > INF:
            print(-1)
            return
    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7



N = INT()
A = LIST()

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

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

Solution (Python):

import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62



def solve(N: int, A: "List[int]"):
    ans = 1
    if 0 in A:
        print(0)
        return 
    for a in A:
        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):
def examA():
    A, B = LI()
    ans = A*B
    print(ans)
    return

def examB():
    N = I()
    A = LI()
    for a in A:
        if a==0:
            print(0)
            return
    ans = 1
    for a in A:
        ans *= a
        if ans>10**18:
            print(-1)
            return
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<60
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

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

print(c)

Solution (Python):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    if 0 in A:
        return print(0)
    ans = A[0]
    for a in A[1:]:
        ans *= a
        if 10**18 < ans:
            ans = -1
            break
    print(ans)


if __name__ == '__main__':
    main()

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

if __name__ == "__main__":
    main()

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

res = 1

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

    else:
        print(res)

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 math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    if 0 in A:
        print(0)
        return
    cur = 1
    for a in A:
        cur *= a
        if cur > 10**18:
            print(-1)
            return
    print(cur)

main()

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

print(cnt)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

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

    print(ans)
    
    

if __name__ == '__main__':
    main()

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

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

res = 1
if min(a) == 0:
    res = 0
for i in a:
    res *= i
    if res > 10 ** 18:
        res = -1
        break

print(res)

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

    a.sort()

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

    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

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

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

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

print(ans)

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

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

Solution (Python):
th = 10**18

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

res = 1

for v in A:
    res *= v
    if res > th:
        print(-1)
        quit()
print(res)

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

print(ans)

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

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

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

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N = Scanner.int()
    A = Scanner.map_int()
    if 0 in A:
        print(0)
        return
    ans = 1
    for a in A:
        ans *= a
        if ans > 10 ** 18:
            print(-1)
            return
    print(ans)


def main():
    
    
    solve()


if __name__ == "__main__":
    main()

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

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 sys
INF = 1 << 60
MOD = 10**9 + 7 
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    MAX = 10 ** 18
    res = 1
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return

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

Solution (Python):
n = int(input())
res = 1
A = sorted(map(int, input().split()))
for a in A:
    res *= a
    if res > 10**18:
        print(-1)
        exit()
print(res)

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

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

print(m)

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)