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

Solution (Python):
import sys

N = int(input())
A = list(map(int, input().split()))
result = A[0]

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

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

print(result)

Solution (Python):
import os
import sys
from io import BytesIO, IOBase


def main():
    n = int(input())
    arr = list(map(int, input().rstrip().split()))
    product = 1
    if 0 in arr:
        print(0)
        return
    for num in arr:
        if product * num > 10**18:
            product = -1
            break
        product *= num
    print(product)


BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

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

result = 1
ok = True
if 0 in A:
    result = 0
else:
    for a in A:
        result *= a
        if result > 10 ** 18:
            ok = False
            break

if ok:
    print(result)
else:
    print(-1)

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





n=ii()
arr=limii()
ans=1

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

for i in arr:
    ans*=i
    if ans>10**18:
        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
bool=True
for i in range(n):
    if a[i]==0:
        bool=False
for i in range(n):
    ans*=a[i]
    if ans>pow(10,18):
        ans=-1
        break
if bool:
    print(ans)
else:
    print(0)

Solution (Python):

n = int(input())
a = list(map(int, input().split()))
m = 1
for i in a:
    m = m * i
    if m > 1000000000000000000:
        m = -1
        break
if 0 in a:
    print(0)
else:
    print(m)

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

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

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

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

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

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

print(m)

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

Solution (Python):

def parse():
  N = int(input())
  A = list(map(int, input().split(" ")))
  return N, A

def power(base, exp):
    """ Fast power calculation using repeated squaring """
    if exp < 0:
        return 1 / power(base, -exp)
    ans = 1
    while exp:
        if exp & 1:
            ans *= base
        exp >>= 1
        base *= base
    return ans

def main():
  N, A = parse()
  A = sorted(A)
  if A[0] == 0:
    print(0)
    exit(0)

  ans = 1
  for n in range(N):
    ans *= A[n]
    
    if ans > power(10, 18):
      print(-1)
      exit(0)
  print(ans)

if __name__ == "__main__":
  main()

Solution (Python):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return

    answer = 1
    for i in range(N):
        answer *= A[i]
        if answer > INF:
            print(-1)
            return

    print(answer)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
A=[int(i) for i in input().split()]
A.sort()
prod=1
for i in range(0,n):
  prod=prod*A[i]
  
  if(prod==0):
      break
  if(prod>1000000000000000000):
    prod=-1
    break
print(prod)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
if min(A) == 0:
  ans = 0
  print(ans)
  quit()

ans = 1
for i in range(N):
  ans = ans * A[i]
  if ans > 10 ** 18:
    print("-1")
    quit()
  
if ans > 10 ** 18:
  print("-1")
  quit()

print(ans)

Solution (Python):
N=int(input())
ans = 1
A = list(map(int,input().split(' ')))
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())
ai = [int(i) for i in input().split()]

ans = 1

ai.sort(reverse=True)

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

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

Solution (Python):
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor, gcd
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10

    N = II()
    A = LMIIS()
    A.sort()
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            return
    print(ans)
    
main()

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

if 0 in a:
    print(0)
else:

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

    print(ans)

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

ans = 1
var = pow(10,18)

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

print(ans)

Solution (Python):



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


sum = 1


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

    
    print(sum)

Solution (Python):
from sys import stdin
def I(): return int(stdin.readline().rstrip())
def LI(): return list(map(int,stdin.readline().rstrip().split()))

n = I()
a = LI()

la = list(a)
if 0 in la:
    print(0)
    exit()
tmp = 1
for i in range(n):
    if pow(10,18)<tmp*a[i]:
        print(-1)
        exit()
    else:
        tmp *= a[i]

print(tmp)

Solution (Python):


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
ans = 1 
upper = int(1e18)
for i in range(n):
    ans *= a[i]
    if ans > upper:
        ans = -1
        break

print(ans)

Solution (Python):

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

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

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


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

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

ans = 1
LIMIT = 1000000000 ** 2
for a in A:
    ans *= a
    if ans > LIMIT:
        print(-1)
        exit()
        
print(ans)

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

Solution (Python):

n = int(input())
a = list(map(int,input().split()))
ans = 1
e = 0
m = 10**18
a.sort()
for i in range(n):
    ans *= a[i]
    if a[i] == 0:
        ans = 0
        e = 0
        break
    if ans > m:
        e = 1
        break


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

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

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

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

print(ans)

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

Solution (Python):
INT_MAX=10**11+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]

n=int(input())
A=INPUT()
bool=False
for i in range(n):
    if A[i]==0:
        bool=True
        break
if bool:
    print(0)
else:
    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()))
ans = A[0]

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

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

print(ans)

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
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()
ans = 1

A.sort()

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
OK=True
for i in range(0,N):
    ans*=A[i]
    if ans>10**18:
        OK=False
        break
if 0 in A:
    OK=True
    ans=0
if OK:
    print(ans)
else:
    print(-1)

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

Solution (Python):
MX = 1000000000000000000
N = int(input())
v = list(map(int, input().split(" ")))
v.sort()
ans = 1
for i in v:
    ans *= i
    if ans > MX:
        print(-1)
        break

if ans <= MX:
    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):
def LI():return list(map(int,input().split()))
def yes():return print("Yes")
def no():return print("No")
from collections import deque, defaultdict, Counter
from heapq import heappop, heappush





n=int(input())


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

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 1
f = True

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

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

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

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

Solution (Python):
N = int(input())
AA = list(map(int,input().split()))
res = AA[0]
if 0 in AA:
  print(0)
else:
  for a in AA[1:]:
    res = res*a
    if res>1e18:
      print('-1')
      exit()
  print(res)

Solution (Python):

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

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

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

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

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

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):

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def main():
    n = II()
    aa = MII()
    t = 1
    if 0 in aa:
        print(0)
        return None
    for a in aa:
        t *= a
        if t > 10**18:
            print(-1)
            return None
    print(t)

if __name__ == '__main__':
    main()

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

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

    inf = 10**18
    res = a[0]
    if 0 in a:
        print(0)
        return 0
    for i in range(1,n):
        res *= a[i]
        if res > inf:
            print(-1)
            return 0

    if res > inf:
        print(-1)
        return 0
    else:
        print(res)

if __name__ == '__main__':
    main()

Solution (Python):

"""
@author: H_Hoshigi
"""
def main():
    N = int(input())
    A_lsit = list(map(int, input().split()))

    answer = 1
    if 0 in A_lsit:
        answer = 0

    for A in A_lsit:
        answer *= A
        if answer > pow(10, 18):
            answer = -1
            break
    print(answer)

if __name__ == "__main__":
    main()

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


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


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()
A = IL()
A.sort()

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

Solution (Python):




def main():
    n = int(input().strip())
    a_l = list(map(int, input().split()))

    if any(i == 0 for i in a_l):
        print(0)
        return

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


if __name__ == '__main__':
    main()

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

Solution (Python):


import os
import sys
from io import BytesIO, IOBase

"""
    for _ in range(int(input())):
    n,m=map(int,input().split())
    n=int(input())
    a = [int(x) for x in input().split()]
"""

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



BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

Solution (Python):
x=10**18
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>x:
            ans=-1
            break
print(ans)

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

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

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

print(total)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
count = 1
k = 10 ** 18
if 0 in a :
  count=0
else :
  for item in a:
    count = count * item
    if count > k:
      break

if count > k:
  print('-1')
else:
  print(count)

Solution (Python):

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

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

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

Solution (Python):
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
A.sort(reverse=True)
if A[-1] == 0:
    print(0)
else:
    s = 1
    for a in A:
        s *= a
        if s == 0:
            print(0)
            break
        if s > 10**18:
            print(-1)
            break
    else:
        print(s)

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

r = 1

for i in A:

    r *= i
    if r > (10 ** 18):
        r = -1
        break

if 0 in A:
    r = 0
    
print(r)

Solution (Python):
n = int(input())
lst = [int(x) for x in input().split()]
res = 1
isHigher = False

if 0 in lst:
  print(0)
else:
  for i in lst:
    res = res * i
    if res > 10**18:
      isHigher = True
      break
  if isHigher:
    print(-1)
  else:
    print(res)

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

tmp = 1

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

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


print(tmp)

Solution (Python):

import math


def inp():
    return(int(input()))



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



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


n = inp()
a = inlist()
a = sorted(a)
res = 1
for i in a:
    res *= i
    if res > 10**18:
        res = -1
        break
print(res)

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

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

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

if flag:
    print(ans)
else:
    if 0 in a:
        print(0)
    else:
        print(-1)

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

LIM = 10 ** 18

N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    quit()

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

Solution (Python):





















MOD = 10**9 + 7
N = int(input())
lisA = list(map(int,input().split()))

ans = lisA[0]
if 0 in lisA:
    print(0)
    exit()

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

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



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

print(ans)