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

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

Solution (Python):


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

ans=1
for ai in a:
    if ai==0:
        ans=0
    if ans!=-1:
        ans*=ai
    if ans>10**18:
        ans=-1

print(ans)

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

sums=1
for i in A:
    sums=sums*i
    if sums>1000000000000000000:
        sums=-1
        break
    
if 0 in A:
    print(0)
else:
    print(sums)

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

ans = 1
if A.count(0) >= 1:
    print(0)
    exit()
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()))

ans = 1
A.sort(reverse = True)
flag = True

if 0 in A:
    ans = 0
    flag = False

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

print(ans)

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

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

"""AtCoder Beginner Contest 169: B - 
https://atcoder.jp/contests/abc169/tasks/abc169_b
"""

__author__ = 'bugttle <bugttle@gmail.com>'


def calc(As):
    MAX = 10 ** 18
    ans = 1
    for n in As:
        if n == 0:
            return 0
        ans *= n
        if MAX < ans:
            return -1
    return ans

def main():
    N = int(input())
    As = list(map(int, input().split()))
            
    if As.count(0) != 0:
        print(0)
    else:
        print(calc(As))

if __name__ == '__main__':
    main()

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

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

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

print(ans)

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

Solution (Python):
import sys
n = int(input())
ans = 1
s = input()
a = [int(x.strip()) for x in s.split(' ')]
if 0 in a:
  print(0)
  sys.exit()
for i in range(n):
  ans *= a[i]
  if ans>1000000000000000000:
    print(-1)
    sys.exit()
print(ans)

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

if __name__ == '__main__':
    main()

Solution (Python):
import math
def main():
    i = int(input())
    j = list(map(int, input().split()))
    res = 1

    if 0 in j:
        print(0)
        return

    for jj in j:
        res *= jj
        if math.pow(10, 18) < res:
            print(-1)
            return

    print(res)


if __name__ == "__main__":
    main()

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











 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod1=998244353
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 MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()] 
def LF(): return [float(x) for x in inp().strip().split()] 
def LS(): return inp().strip().split() 
def I(): return int(inp().strip()) 
def F(): return float(inp().strip()) 
def S(): return inp().strip() 
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a)) 
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r,p):                      
    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p
    return t


def solve():
    n = I()
    a=LI()
    p = 1
    flag=0
    for i in a:
        p*=i
        if p>10**18:
            flag=1
            break
    if 0 in a:
        print(0)
    elif p>10**18 or flag==1:
        print(-1)
    else:
        print(p)
def main():
    solve()


py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s
    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

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

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            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)

inp = lambda: sys.stdin.readline().rstrip('\r\n')
out = lambda x: sys.stdout.write(x)
flsh= lambda: sys.stdout.flush()

if __name__ == "__main__":
    main()

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

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

Solution (Python):
N = int(input())
nums = sorted(map(int, input().split()))
if nums[0] == 0:
    print(0)
else:
    ans = 1
    for num in nums:
        ans = ans * num
        if ans > 10**18:
            break
    if ans > 10**18:
        print('-1')
    else:
        print(ans)

Solution (Python):
import sys
_ = int(input())
ns = list(map(int, input().split()))
total = 1
flg = False
if 0 in ns:
    print(0)
    sys.exit(0)
for n in ns:
    if total > 10**18:
        flg = True
        break 
    total = total*n
if flg or total > 10**18:
    print(-1)
else:
    print(total)

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

Solution (Python):
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase






def main():
    
    
    n=int(input())
    arr=[int(k) for k in input().split()]
    res=1
    counter=0
    for i in range(n):
        if arr[i]==0:
            counter=1
            print(0)
            break
    if counter==0:
        count=0
        for i in range(n):
            res*=arr[i]
            if res>10**18:
                count=1
                print(-1)
                break
        if count!=1:
            print(res)








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 = input()

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

temp = pow(10, 18)
ans = 1
flag = 0

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

if flag == 0:
    print(ans)

Solution (Python):



LIMIT = 10 ** 18


def prod(xs):
    xs.sort()
    res = 1
    if 0 in xs:
        return 0
    for x in xs:
        res *= x
        if res > LIMIT:
            return None
    return res


def main():
    n = int(input())
    bs = [int(z) for z in input().split()]
    res = prod(bs)
    if res is None:
        print(-1)
    else:
        print(res)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  maximam = 10**18

  result = 1
  if 0 in A:
    print(0)
    return True

  for a in A:
    result *= a
    if result > maximam:
      print(-1)
      return True
  print(result)

if __name__ == "__main__":
    resolve()

Solution (Python):
import numpy as np

def test():
    D = 1e18
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return 0
    s = 1
    for i in A:
        s *= i
        if s > D:
            print(-1)
            return 0
    print(s)
    return 0

if __name__ == "__main__":
    test()

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

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

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

Solution (Python):
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().split()))
ans = 1

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

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

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

Solution (Python):
FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

N = rri()
arr = rrm()



def solve(N, arr):
    ans= arr[0]
    if 0 in arr:
        return 0
    for i in range(1, N):
        if ans > 10**18:
            return -1
        else:
            ans *= arr[i]
    if ans >10**18:
        return -1
    return ans

print(solve(N, arr))

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

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

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=1
for i in range(n):
  if a[i]==0:
    b=0

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

Solution (Python):
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math



input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split(" ")))
ans = 1
lim = 10**18

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


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

print(ans)

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

s=1
over=False

if 0 in ls:
    s=0
else:
    for i in ls:
        s*=i
        if s>10**18:
            over=True
            break


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

Solution (Python):
'''input
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0
'''

n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = 1
for i in arr:
	ans = ans*i 
	
	if(ans > 1e18):
		print(-1)
		exit()


print(ans)

Solution (Python):
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())

"""========main code==============="""
t=ii()

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

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

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

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

n = int(ipt())
a = [int(i) for i in ipt().split()]
if 0 in a:
    print(0)
    exit()
ans = 1
for i in a:
    if 10**18/ans < i:
        print(-1)
        exit()
    ans *= i
if ans > 10**18:
    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 range(n):
    ans = ans * a[i]

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

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

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

A.sort()

res = 1

for a in A:
  res *= a
  if res > 1000000000000000000:
    print(-1)
    quit()

print(res)

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

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

Solution (Python):


import sys
import math
import time

import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools



sys.setrecursionlimit(10**7)






N = int(input())
A =  [int(i) for i in input().split()]
ans = 1
flag = 0

for i in range(N):
    ans *= A[i]
    if(10**18<ans):
        flag = 1
        break

if(0 in A):
    print(0)
elif(flag == 1):
    print(-1)
else:
    print(ans)

Solution (Python):
import math

N=int(input())
A=list(map(int, input().split()))
a=A[0]
if 0 in A:
  print(0)
  exit(0)  

for i in range(1,len(A)):
  a*=A[i]
  if pow(10,18)<a:
    print('-1')
    exit(0)
print(a)

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

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

Solution (Python):
from sys import exit

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

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

ans = 1
for x in a:
    if x > 1000000000000000000//ans+1:
        print(-1)
        exit()
    ans *= x
    if ans > 1000000000000000000:
        print(-1)
        exit()
print(ans)

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

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

for j in range(n):
  if a[j]==0:
    print(0)
    flag = 1

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

  if flag == 0:
    print(mul)

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

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

Solution (Python):

import numpy as np

n = int(input())

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

ans = 1

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

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

Solution (Python):
N = int(input())
a_list = [int(_c) for _c in input().split(" ")]
a_list = sorted(a_list)

res = 1
flg = False
for a in a_list:
    res = res * a
    if res > 10 ** 18:
        flg = True
        break

if flg:
    print(-1)
else:
    print(res)

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

ans = 1

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=1
k=0
if a[-1]==0:
    print(0)
    exit()
else:
    while k<n:
        if len(str(ans))<19:
            ans*=a[k]
            k+=1
        else:
            print(-1)
            exit()
if len(str(ans))<19 or ans==10**18:
    print(ans)
else:
    print(-1)

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

Solution (Python):
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RA():return map(int,open(0).read().split())
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'

    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in range(base**n):s=[tb//(base**bt)%base for bt in range(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
 
YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase

read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
input=lambda: sys.stdin.readline().rstrip()


class Tree:
    def __init__(self,inp_size=None,ls=None,init=True,index=0):
        self.LCA_init_stat=False
        self.ETtable=[]
        if init:
            if ls==None:
                self.stdin(inp_size,index=index)
            else:
                self.size=len(ls)+1
                self.edges,_=GI(self.size,self.size-1,ls,index=index)
        return
 
    def stdin(self,inp_size=None,index=1):
        if inp_size==None:
            self.size=int(input())
        else:
            self.size=inp_size
        self.edges,_=GI(self.size,self.size-1,index=index)
        return
    
    def listin(self,ls,index=0):
        self.size=len(ls)+1
        self.edges,_=GI(self.size,self.size-1,ls,index=index)
        return
 
    def __str__(self):
        return  str(self.edges)
 
    def dfs(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append(x)
        v=[-1]*self.size
        v[x]=root_v
        while q:
            c=q.pop()
            for nb,d in self.edges[c]:
                if v[nb]==-1:
                    q.append(nb)
                    v[nb]=func(v[c],nb,d)
        return v
 
    def EulerTour(self,x):
        q=deque()
        q.append(x)
        self.depth=[None]*self.size
        self.depth[x]=0
        self.ETtable=[]
        self.ETdepth=[]
        self.ETin=[-1]*self.size
        self.ETout=[-1]*self.size
        cnt=0
        while q:
            c=q.pop()
            if c<0:
                ce=~c
            else:
                ce=c
                for nb,d in self.edges[ce]:
                    if self.depth[nb]==None:
                        q.append(~ce)
                        q.append(nb)
                        self.depth[nb]=self.depth[ce]+1
            self.ETtable.append(ce)
            self.ETdepth.append(self.depth[ce])
            if self.ETin[ce]==-1:
                self.ETin[ce]=cnt
            else:
                self.ETout[ce]=cnt
            cnt+=1
        return
    
    def LCA_init(self,root):
        self.EulerTour(root)
        self.st=SparseTable(self.ETdepth,init_func=min,init_idl=inf)
        
        self.LCA_init_stat=True
        return
    
    def LCA(self,root,x,y):
        if self.LCA_init_stat==False:
            self.LCA_init(root)
        xin,xout=self.ETin[x],self.ETout[x]
        yin,yout=self.ETin[y],self.ETout[y]
        a=min(xin,yin)
        b=max(xout,yout,xin,yin)
        id_of_min_dep_in_et=self.st.query_id(a,b+1)
        return self.ETtable[id_of_min_dep_in_et]




class SparseTable: 
    def __init__(self,ls,init_func=min,init_idl=float('inf')):
        self.func=init_func
        self.idl=init_idl
        self.size=len(ls)
        self.N0=self.size.bit_length()
        self.table=[ls[:]]
        self.index=[list(range(self.size))]
        self.lg=[0]*(self.size+1)
        
        for i in range(2,self.size+1):
            self.lg[i]=self.lg[i>>1]+1
 
        for i in range(self.N0):
            tmp=[self.func(self.table[i][j],self.table[i][min(j+(1<<i),self.size-1)]) for j in range(self.size)]
            tmp_id=[self.index[i][j] if self.table[i][j]==self.func(self.table[i][j],self.table[i][min(j+(1<<i),self.size-1)]) else self.index[i][min(j+(1<<i),self.size-1)] for j in range(self.size)]
            self.table+=[tmp]
            self.index+=[tmp_id]
    
    
    def query(self,l,r):
        if r>self.size:r=self.size
        
        N=self.lg[r-l]
        return self.func(self.table[N][l],self.table[N][max(0,r-(1<<N))])
    
    
    def query_id(self,l,r):
        if r>self.size:r=self.size
        
        N=self.lg[r-l]
        a,b=self.index[N][l],self.index[N][max(0,r-(1<<N))]
        if self.table[0][a]==self.func(self.table[N][l],self.table[N][max(0,r-(1<<N))]):
            b=a
        return b
    
    
    def right_bound(self,pos,x):
        k=(self.size-pos).bit_length()
        for j in range(k)[::-1]:
            nx=pos+(1<<j)
            if nx<n and self.query(pos,nx+1)<=x:
                pos+=(1<<j)
        return pos
    
    
    def left_bound(self,pos,x):
        k=pos.bit_length()
        for j in range(k)[::-1]:
            nx=pos-(1<<j)
            if 0<=nx and self.query(nx,pos+1)<=x:
                pos-=(1<<j)
        return pos

    def __str__(self):
        return str(self.table[0])
 
    def print(self):
        for i in self.table:
            print(*i)
 



def primeFactor(N):
    i,n=2,N
    ret={}
    d,sq=2,99
    while i<=sq:
        k=0
        while n%i==0:
            n,k,ret[i]=n//i,k+1,k+1
        if k>0 or i==97:
            sq=int(n**(1/2)+0.5)
        if i<4:
            i=i*2-1
        else:
            i,d=i+d,d^6
    if n>1:
        ret[n]=1
    return ret




def PrimeNumSet(N):
    Max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList:
        if seachList[0] <= Max:
            break
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum



def LCM(b,mo=10**9+7):
    prs=PrimeNumSet(max(b))
    M=dict(zip(prs,[0]*len(prs)))
    for i in b:
        dc=primeFactor(i)
        for j,k in dc.items():
            M[j]=max(M[j],k)
    
    r=1
    for j,k in M.items():
        if k!=0:
            r*=pow(j,k,mo)
            r%=mo
    return r

 
show_flg=False
show_flg=True
ans=0

n=I()
a=LI()
ans=1
L=10**18
if 0 in a:
    print(0)
    exit()
    
for i in a:
    ans*=i
    if ans>L:
        ans=-1
        break

print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
num=1
if l.count(0)!=0:
    print(0)
else:
    flag=True
    for i in l:
        if num>10**18:
            print(-1)
            flag=False
            break
        else:
            num*=i
    if flag==True:
        if num>10**18:
            print(-1)
        else:
            print(num)

Solution (Python):
import collections
N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
def main():
    if c[0] >0:
        print(0)
        return

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

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

s = 1
mod = pow(10, 18)

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

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

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

"""

"""

tot = 1
n = int(input())
arr = map(int, input().split())

for v in arr:
    if v == 0:
        tot = 0
        break
    if tot <= 10**18:
        tot *= v
    

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

Solution (Python):
import sys

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

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


print(ans)

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

MAX = int(1e18)
tmp = 0 if 0 in A else 1
flag = False

for a in A:
    tmp *= a
    if tmp > MAX:
        flag = True
        break

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

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