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

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

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

print(ans)

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

Solution (Python):

import math 


if __name__ == "__main__":
    n = int(input())
    l = list(map(int,input().split()))
    if 0 in l :
        print("0")
    else :
        flag = 1
        prod = 1
        for i in range(n) :
            prod = prod * l[i]
            if prod > int(math.pow(10,18)) :
                flag = 0 
                break 
        if flag == 0 :
            print("-1")
        else :
            print(prod)

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

Solution (Python):

"""
Created on Sun May 31 21:01:14 2020

@author: NEC-PCuser
"""

N = int(input())
A = list(map(int, input().split()))
MAX = 10 ** 18
ans = 1
zero_flg = False
for i in A:
    if (i == 0):
        print(0)
        zero_flg = True
        break
    
if (zero_flg == False):
    for i in A:
        ans *= i
        if (ans > MAX):
            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)
else:
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            print(-1)
            exit()

    print(ans)

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

Solution (Python):
def f(A):
    if 0 in A:
        return 0

    x = 1

    for a in A:
        x *= a
        if x > 10**18:
            return -1

    return x

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

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

for a in sorted(input().split()):
    ans *= int(a)
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Solution (Python):
def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split())) 
def intListVertical(): [int(input()) for _ in range(N)] 


n = int(input())


a = intList()


ans = 1
limit = 1000 * 1000 * 1000 * 1000 * 1000 * 1000

for i in range(n):
    if a[i] == 0:
        print(0)
        exit()

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

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

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

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

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]








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

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

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

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

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

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

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

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

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

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

Solution (Python):
import sys


def main():
    N = int(input())
    A = list(map(int, input().split()))
    res = 1

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

    for a in A:
        res = res * a
        if res > pow(10, 18):
            print("-1")
            sys.exit()
    print(res)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

Solution (Python):


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

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

    print(ret)

if __name__ == '__main__':
    main()

Solution (Python):
def solve(a):
    if 0 in a:
        return 0
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            return -1
    else:
        return ans

if __name__ == '__main__':
    n = int(input())
    a = list(map(int,input().split()))
    print(solve(a))

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

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

print(ans)

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

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

def main(A):
    a = 1
    for x in A:
        if x == 0:
            return 0
    for x in A:
        a *= x
        if a > U:
            return -1
    return a

print(main(A))

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

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

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

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

    ans = 1
    if 0 in As:
        print(0)
        exit()

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
alist = [int(s) for s in input().split(" ")]
alist.sort()

if alist[0] == 0:
  print(0)
else:
  ans = 1
  ok = True
  for a in reversed(alist):
    ans *= a
    if ans > 1e18:
      ok = False
      break
  if ok:
    print(ans)
  else:
    print(-1)

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

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

Solution (Python):
n = int(input())
a = input().split()
ans = 1
for i in a:
  if i=='0':
    ans = 0
    break
for i in a:
  ans = ans * int(i)
  if ans>1000000000000000000:
    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):
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 1
for i in a:
  ans *= i
  if ans > 10**18:
    ans = -1
    break
print(ans)

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

res = 1

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

for e in nums:
    if res == -1:
        if e == 0:
            res = 0

        continue
    res *= e
    if res > 10 ** 18:
        res = -1


print(res)

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

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

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

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

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

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

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

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

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


print(ans)

Solution (Python):
import math
n = input()
A = list(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):
from sys import stdin
from copy import deepcopy
from functools import reduce
from fractions import gcd
import math
import itertools
from collections import Counter
from itertools import chain  
from heapq import heappush, heappop
import bisect

"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) 
A = [int(input()) for _ in range(N)] 
lst = [list(map(int,input().split())) for i in range(M)] 
"""

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

A.sort(reverse=True)

LIMIT = int(1e18)

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

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

print(ans)

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

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

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

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

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

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div

N = ri()
A = ri_()
ans = 1
for i in range(N):
    ans = ans * A[i]
    if ans > 1000000000000000000:
        ans = -1
        break
if 0 in A:
    print(0)
else:
    print(ans)

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

Solution (Python):
n = int(input())
a = [int(x) for x 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, bisect, math, itertools, heapq, collections
from operator import itemgetter

from functools import lru_cache

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


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

Solution (Python):
import sys


def solve(a):
    ans = 1
    over = False
    for e in a:
        if not over:
            ans *= e
        else:
            if e == 0:
                return 0
        if ans > 10 ** 18:
            over = True
    if not over:
        return ans
    else:
        return -1


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    print(solve(a))


if __name__ == '__main__':
    main()

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

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

A.sort()

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

print(ans)

Solution (Python):
import itertools
import copy
from collections import deque
import heapq
n = int(input())
a = list(map(int,input().split()))
a.sort()
a = a[::-1]
ans = 1
if a[-1] == 0:
    print(0)
    exit()
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
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):


"""
    Author : thekushalghosh
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()


    
def solve():
    n = inp()
    a = inlt()
    q = 1
    for i in range(n):
        q = q * a[i]
        if q > 10 ** 18:
            q = -1
            break
    if 0 in a:
        q = 0
    print(q)
                


 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
    sys.stdout.close()
    

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))


def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline  
main()

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

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

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

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

print(res)

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

Solution (Python):
import sys
import math
import copy

def multiply(N, AList):
    Multiply = 1
    for Num in range(N):
        if(AList[Num] == 0):
            return 0
    for Num in range(N):
        Multiply *= AList[Num]
        if(Multiply > 10**18):
            return -1
    return Multiply


if(__name__ == "__main__"):

    N = int( input().strip() )
    AList_Str = input().strip().split()
    AList = [0] * N
    for Num in range(N):
        AList[Num] = int( AList_Str[Num] )


    Multiplies = multiply(N, AList)
    print(Multiplies)

Solution (Python):

import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

a = LIST()
a.sort()
if(0 in a):
    print(0)
else:
    ans = 1
    for el in a:
        ans*=el
        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(' ')))
ans=1
key=0
for x in a:
    if key==0:
        ans*=x
    if key==0 and ans>10**18:
        ans=-1
        key=1
    if x==0 and key==1:
        ans=0
        break
print(ans)

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

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

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

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

print(ans)

Solution (Python):

import numpy as np
from collections import deque
import collections
import heapq
N = int(input())
a = list(map(int, input().split()))
ans = 1
max_ = pow(10, 18)
if 0 in a:
    print(0)
    exit()
for tmp in a:
    ans *= tmp
    if (ans > max_):
        print(-1)
        exit()
print(ans)

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

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

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

maxs = 10**18

def main():
    for i in line:
        if i==0:
            return 0
    ans = 1
    for i in line:
        ans *= i
        if ans > maxs:
            return -1
    return ans

print(main())

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

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

product = 1
flag = 0

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

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

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

output = A[0]

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

Solution (Python):
import sys

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

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

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

print(total)

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

A.sort()

sum = 1
for i in A:
    sum *= i
    if sum > 10**18:
        sum = -1
        break

ans = sum

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
X = 1
if 0 in A:
  print(0)
else:
  flg = True
  for i in range(N):
    X *= A[i]
    if X > int(1e18):
      flg = False
      break
  if flg:
    print(X)
  else:
    print(-1)

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

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

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

Solution (Python):
import sys

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

ans = 1
if 0 in A:
    print(0)
    sys.exit()
for a_i in A:
    ans *= a_i
    if ans > 10**18:
        print(-1)
        sys.exit()

print(ans)

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

result = 1
for x in sorted(a):
    result *= x

    if result == 0:
        print(0)
        exit()

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

print(result)

Solution (Python):

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

ans=1
flg=True

for i in range(N):
    ans*=A[i]
    if ans>10**18:
        flg=False
        break
for i in range(N):
    if A[i]==0:
        flg=True
        ans=0
        break

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

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

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

t.sort()

ans = 1

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

print(ans)

Solution (Python):
from sys import stdin
import sys

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

Solution (Python):
def main():
    _ = int(input())
    a = [int(x) for x in input().split()]

    if 0 in a:
        print(0)
        return

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

    print(ans)


main()

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

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 range(1, n + 1):
    ans *= a[-i]
    if ans > 10 ** 18:
        print('-1')
        exit()
print(ans)

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

x = 1
a.sort()
for i in range(0,n):
    x *= a[i]
    if x > 10**18:
        print(-1)
        exit()

print(x)

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

if 0 in a:
    ans = 0
else:
    for i in a:
        if ans <= 1000000000000000000:
            ans *= i
        else:
            ans = -1
            break
if ans > 1000000000000000000:
    ans = -1

print(ans)

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

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

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

print(res)

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

inf = 10**18

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

print(int(ans))

Solution (Python):



def solve(*args: str) -> str:
    n = int(args[0])
    A = list(map(int, args[1].split()))
    A.sort()

    ret = 1
    for a in A:
        if 10**18 < ret*a:
            ret = -1
            break
        else:
            ret *= a

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

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

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

print(ans)

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

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
  exit(0)
res = 1
for x in a:
  res *= x
  if res > 10 ** 18:
    print(-1)
    exit(0)
print(res)

Solution (Python):

import sys
import numpy as np


def solve(N: int, A: "List[int]"):
    ans = A[0]

    if min(A)==0:
        print(0)
        return

    for i in range(1, N):
        ans *= A[i]
        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):
LI = lambda: list(map(int, input().split()))

n = int(input())
a = LI()
prod = 1
if 0 in a:
    print(0)
else:
    for x in a:
        prod *= x
        if prod > 10**18:
            print(-1)
            break
    else:
        print(prod)

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

Solution (Python):


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

    big = 10**18
    count = 1

    ju = True


    if 0 in A:
        count = 0
    else:
        for i in range(len(A)):
            count = count * A[i]

            if count > big:
                ju = False
                break


    if ju:
        print(count)
    else:
        print("-1")




if __name__ == '__main__':
    main()

Solution (Python):
n  = int(input())
arr = list(map(int, input().split(" ")))
z = 10 ** 18
ret = 1
for i in arr:
    
    if(ret != -1):
        ret *= i
    elif ret == -1 and i == 0:
        ret = 0
    if( ret > z):
        ret = -1
    
print(ret)