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())
nums = list(map(int, input().split()))

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

Solution (Python):
def multiplyList(myList) : 
      
    
    result = 1
    for x in myList: 
        result = result * x
        if result == 0:
             return 0 
        if result > 10**18:
             return -1
    return result
 
n = int(input())
l = list(map(int, input().split()))
l.sort()
res = multiplyList(l)
print(res)

Solution (Python):
import sys

L = []
for l in sys.stdin:
  L.append(l) 
A = list(map(int, L[1].split()))

if 0 in A:
  print(0)
else:
  answer = 1
  for a in A:
    answer = answer * a
    if answer > 1000000000000000000:
      print(-1)
      break
  if answer <= 1000000000000000000:
    print(answer)

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

a=input().split()
ans=1
if '0' in a:
    print(0)
else:   
    for i in range(n):
        k=int(a[i])
        if ans*k>1e18:
            print(-1)
            break
        ans*=k
        if i==n-1:
            print(ans)

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

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

ans = 1
keta = 0
if 0 in A:
  print(0)
  exit()

for x in A:
  ans *= x
  keta += len(str(x))
  if ans > 1000000000000000000:
    print(-1)
    exit()

print(ans)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
from math import floor,ceil,sqrt,factorial,log
from heapq import heapify, 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 decimal import Decimal
inf = float('inf')
mod = 1000000007

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

ans = 1
flag = True
for i in range(len(a)):
    if a[i] == 0:
        print(0)
        exit()

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

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

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

Solution (Python):
def solve(ls):
    n = len(ls)
    p = 1
    for i in range(n):
        if ls[i] == 0:
            return 0
    for i in range(n):
        p *= ls[i]
        if p > 1000000000000000000:
            return -1
    return p


n = int(input())
ls = list(map(int, input().split()))
print(solve(ls))

Solution (Python):
N = int(input())
temp = input()
temp = temp.split(" ")
arr = []
prod=1
for i in range(N):
    arr.append(int(temp[i]))
arr.sort()
flag=0    
for i in range(N):
    prod = prod*arr[i]
    if prod>1000000000000000000:
        flag=1
        break
if flag==0:
    print(prod)
else:
    print(-1)

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

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

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

  if b == 0:
    print(ans)
  else:
    print(-1)

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

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

if(__name__=="__main__"):
    __main__()

Solution (Python):
from collections import Counter
n = int(input())
a = list(map(str,input().split()))
ans = 1
b = Counter(a)
b0 = 0
b1 = 0

if '0' in a:
    b0 = b['0']
if '1' in a:
    b1 = b['1']
more2 = n-b0-b1
if b0 >0:
    print(0)
elif more2 >=60:
    print(-1)
else:
    for i in range(n):
        ans *= int(a[i])
    if ans > 10**18:
        print(-1)
    else:
        print(ans)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split(" ")]
res=1
xx=10**18
f=0
a.sort()
for i in a:
    res*=i
    if res>xx:
        f=1
        print(-1)
        break

if f==0:
    print(res)

Solution (Python):
import sys

INF = 10e17
N = int(input())
A = list(map(int, sys.stdin.readline().rstrip().split()))
ans = 1
for a in A:
    if a == 0:
        print(0)
        sys.exit()
for a in A:
    ans = ans*a
    if ans > INF:
        print(-1)
        sys.exit()

print(ans)

Solution (Python):
import collections
import sys


def pow2(x, n):
    ret = 1
    while (n > 0):
        if (n & 1):
            ret *= x
        x *= x
        n = n >> 1
    return ret


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

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

c = collections.Counter(a)

l = sorted(list(c.keys()))

ans = 1
for num in l:
    ans *= pow2(num, c[num])
    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)
print(ans)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
if A[-1] == 0:
    print(0)
    exit()

ans = A[0]
lim = 10**18
for a in A[1:]:
    ans *= a
    if ans > lim:
        print('-1')
        exit()
print(ans)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
prod = 1
ans = 0
for i in arr:
    if (i == 0):
        ans+=1
    
if(ans == 1):
    prod = 0

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

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

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

for i in range(N):
    ans = ans * An[i]
    if ans > 10**18:
        flag = False
        break
    else:
        continue
    
if flag:
    print(ans)
else:
    print(-1)

Solution (Python):
import sys
n = int(input())
l = list(map(int,input().split()))


x = l[0]
if 0 in l:
  print(0)
  sys.exit()
for i in range(1,n):
  
  
  x *= l[i]
  if x >+ 1000000000000000000:
    
    
    print(-1)
    sys.exit()
print(x)

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

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

print(ans)

Solution (Python):
intNum = int(input())
numList = [int(x) for x in input().split()]

total = 1
judgeNum = 10 ** 18

if 0 in numList:
    total = 0
else:
    for num in numList:
        total *= num

        if total > judgeNum:
            total = -1
            break

print(total)

Solution (Python):
N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1

if A_dict.get(0, 0) > 0:
    ans = 0
else:
    for val in A_dict:
        ans *= val ** A_dict[val]

        if ans > limit:
            ans = -1
            break

print(ans)

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[n-1] == 0:
    print("0")
    exit()
ans = 1
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()))
if 0 in A:
    print(0)
else:
    bound = 10 ** 18
    ans = 1
    for a in A:
        ans = ans * a
        if ans > bound:
            ans = -1
            break
    print(ans)

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

a = 1
if 0 in x:
  print(0)
else:
  for i in x:
    a *= i
    if a > pow(10,18):
      print(-1)
      break
  else:
    print(a)

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

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

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

print(ans)

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

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

s =list(map(int, input().split()))
s.sort()
a = 1
for i in range(n):
    a = a * s[i]
    if a > 1000000000000000000:
        print('-1')
        exit()
    else:
        if a == 0:
            print('0')
            exit()

print(a)

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

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

ans = 1000000000000000000
prod = 1
f = 0
f2 = 0

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

for i in range(n):
    prod = prod * a[i]

    if prod > ans:
        f2 = 1
        break

if f == 1:
    print(0)

else:
    if f2 == 1:
        print(-1)
    else:
        print(prod)

Solution (Python):
n=int(input())
mx=10**18
z=1

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

for i in a:
    z*=i
    if z>mx:    z=-1
    if z==-1:   break

if z>mx or z<0   : z=-1
print(z)

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

MAX_NUM = 10 ** 18

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

for num in nums:
  if num == 0:
    print(0)
    exit()

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

print(ans)

Solution (Python):
num = int(input())
h = input().split()
hi = sorted(h)




ans = 0
 
for i in range(num):
    if i == 0:
        ans = ans + int(hi[i])
    else:
        ans = ans * int(hi[i])
        if ans > 10**18 or ans == 0:
            break
if ans <= 10**18:
    print(ans)
else:
    print("-1")

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

print(s)

Solution (Python):

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

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

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

print(ans)

Solution (Python):
import numpy as np

def multiple(nums):
    result_log = 0
    result = 1
    if (np.any(np.array(a) == 0)): return 0

    for a_ in a:
        result_log += np.log10(a_)
        if (result_log > 18.0):
            return -1
        result *= a_
        if (result > 10**18):
            return -1
    return result

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

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    res = 1
    for i in a_s:
        res *= i
        if res == 0:
            print(0)
            break
        if res > 10 ** 18:
            print(-1)
            break
    if res > 0 and res <= 10 ** 18:
        print(res)
if __name__ == '__main__':
    main()

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

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

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

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


n = I()
a = LI()
ans = a[0]
if 0 in a:
    print(0)
    sys.exit()

for ai in a[1:]:
    ans *= ai
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)

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

prod = 1
frg_overflow = False

if 0 in a:
  print(0)
else:
  for i in range(n):
    if prod <= 10**18:
      prod = prod * a[i]
    else:
      frg_overflow = True
  if frg_overflow == True:
    print(-1)
  elif prod > 10**18:
    print(-1)
  else:
    print(prod)

Solution (Python):
def main(n, a):
  a = list(a)
  for x in a:
    if(x == 0):
      print(0)
      return
   
  ans = a[0]
  for i in range(1, n):
    ans = ans * a[i]
    if(ans > 1000000000000000000):
      print(-1)
      return
  print(ans)
 
if(__name__ == '__main__'):
  n = int(input())
  a = map(int, input().split())
  main(n, a)

Solution (Python):
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    if 0 in a: return 0
    l = Counter(a)
    ans = 1
    for i,j in l.items():
        ans *= i**j
        if ans > int(1e18):
            return -1

    return ans
    

print(solve())

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

ans = 1

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

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

Solution (Python):
import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)


MOD = int(1e9 + 7)
INF = 1e18
DX = [0,  0, 1, -1, 1,  1, -1, -1, 0]
DY = [1, -1, 0,  0, 1, -1,  1, -1, 0]
PI = 3.14159265358979323846264338327950288

"""=======　関数 ==============================================================="""

def divisor(n):
    ret = []
    for i in range(1, n+1):
        if i*i > n:
            break
        if n % i == 0:
            ret.append(i)
            if i*i != n:
                ret.append(n/i);
    return sorted(ret)


def search_sosuu(n):
    sosuu = [True] * n
    sosuu[0] = sosuu[1] = False
    for i in range(2, n):
        if sosuu[i]:
            for j in range(2, n):
                if(i*j > n):
                    break
                else:
                    sosuu[i*j] = False
    return sosuu


def div_prime(n):
    prime_factor = []
    for i in range(2, n+1):
        if i*i > n:
            break
        count = 0
        while n % i == 0:
            count += 1
            n //= i
        if count:
            prime_factor.append((i, count))
    if n != 1:
        prime_factor.append((n, 1))
    return prime_factor


def is_sosuu(n):
    if n < 2:
        return False
    elif n == 2:
        return True
    elif N%2 == 0:
        return False
    for i in range(3, int(math.sqrt(n)), 2):
        if n % i == 0:
            return False
    return True


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


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


def factorial(n):
    if n <= 1:
        return 1
    return (n * factorial(n-1)) % MOD


MAX_COMB = 200005
fac = [0] * MAX_COMB
finv = [0] * MAX_COMB
inv = [0] * MAX_COMB
com_inited = False
def COMinit():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX_COMB):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    com_inited = True
def com(n, k):
    if not com_inited:
        COMinit()
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


def repeat_squaring(base, sisuu):
    if sisuu == 0:
        return 1
    if sisuu % 2 == 0:
        t = repeat_squaring(base, sisuu / 2) % MOD
        return t * t % MOD
    return base * repeat_squaring(base, sisuu - 1) % MOD


def fast_com(a, b):
    bunshi = 1
    bunbo = 1
    for i in range(1, b + 1):
        bunbo *= i
        bunbo %= MOD

        bunshi *= (a - i + 1)
        bunshi %= MOD

    ret = bunshi * repeat_squaring(bunbo, MOD - 2) % MOD

    while ret < 0:
        ret += MOD
    return ret


def is_cross(x1, y1, x2, y2, X1, Y1, X2, Y2):
    dx_ai = X1 - x1;
    dy_ai = Y1 - y1;
    dx_bi = X1 - x2;
    dy_bi = Y1 - y2;
    
    dx_ai2 = X2 - x1
    dy_ai2 = Y2 - y1
    dx_bi2 = X2 - x2
    dy_bi2 = Y2 - y2

    si = dx_ai * dy_bi - dy_ai * dx_bi
    si2 = dx_ai2 * dy_bi2 - dy_ai2 * dx_bi2
    
    si3 = dx_ai * dy_ai2 - dy_ai * dx_ai2
    si4 = dx_bi * dy_bi2 - dy_bi * dx_bi2

    return si * si2 < 0 and si3 * si4 < 0


def tree_depth(edge, start_node, n_node):
    dist = [INF] * n_node
    dist[start_node] = 0

    S = queue.LifoQueue()
    S.put((start_node, 0))

    while not S.empty():
        node, d = S.get()
        dist[node] = d

        for next in edge[node]:
            if d[next] == INF:
                S.put((next, d + 1))

    return dist


'''
1行のint=====================================
N, K = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''



N = int(input())

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

ans = 1

for a in A:
    if a == 0:
        print(0)
        sys.exit()

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

print(ans)

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

A = input().split()  

answer = 1

sort = sorted(A)

for i in range(N) :
    answer = answer * int(sort[i])
    if answer == 0:
        print('0')
        quit()
    if answer > 1000000000000000000 : 
        print('-1')
        quit()


print(answer)

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

reg = A[0]
flg=True
if 0 in A:
    print(0)
    flg=False
    reg=0
for i in range(1, N):
    reg *= A[i]
    if reg>10**18:
        print(-1)
        flg=False
        break
if flg:
    print(reg)

Solution (Python):

import sys
import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


n = I()
a = list(MI())

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

print(ans)

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

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

if 0 in A:
    print(0)
elif max(A) > 10**18:
    print(-1)
else:
    for i in A:
        B *= i
        if B > 10 ** 18:
            B = -1
            break
    print(B)

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

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

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

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

Solution (Python):
N = int(input())
A = sorted([int(i) for i in input().split()])
res=1
for x in A:
    res = res*x
    if res > 10 ** 18:
        res = -1
        break
print(res)

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):
    if len(str(ans))>=19:
      ans='-1'
      break
    else:
      ans*=a[i]
if ans==1000000000000000000:
  ans=1000000000000000000
elif len(str(ans))>=19:
  ans=-1
print(ans)

Solution (Python):
import functools
import operator

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

if 0 in a_list:
    ans = 0
else:
    k = len(a_list) - a_list.count(1)
    
    if k > 60:
        ans = -1
    else:
        ans = functools.reduce(operator.mul, a_list)
        if ans > 10 ** 18:
            ans = -1
        else:
            pass
print(ans)

Solution (Python):
import numpy as np
import sys
n=int(input())
s=input().split()
ans=1
d=1;
e=1
for i in s:
    if i=='0':
        e=0


for i in range(n):
    ans=ans*int(s[i])
    if ans>np.power(10,18):
        d=0
        break;

if d==0 and e==1:
    print(-1)
elif e==0:
    print(0)
else:
    print(ans)

Solution (Python):
from sys import stdin

lines = stdin.readlines()
n = int(lines[0])
a = sorted(map(int, lines[1].split()))
ans = 1
for x in a:
    ans *= x
    if ans > 1e18 or ans < 0: ans = -1
print(ans)

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


print(ans)

Solution (Python):

from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil, factorial, log,tan,pi,cos,sin,radians
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
from fractions import Fraction
from functools import reduce
from decimal import *
import string
import sys
import os
import re
inf = float('inf')
mod_ = int(1e9) + 7
mod = 998244353

def factors(n):
    from functools import reduce
    return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def sieve(m):
    n=1
    primes = {}
    arr=set([])
    for i in range(2, int(m ** 0.5) + 1):
        a = n // i
        b = m // i
        for k in range(max(2, a), b + 1):
            c = i * k
            primes[c] = 1

    for i in range(max(n, 2), m + 1):
        if i not in primes:
            arr.add(i)

    return arr


class DisjointSetUnion:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
 
    def find(self, a):
        acopy = a
        while a != self.parent[a]:
            a = self.parent[a]
        while acopy != a:
            self.parent[acopy], acopy = a, self.parent[acopy]
        return a
 
    def union(self, a, b):
        a, b = self.find(a), self.find(b)
        if a != b:
            if self.size[a] < self.size[b]:
                a, b = b, a
 
            self.num_sets -= 1
            self.parent[b] = a
            self.size[a] += self.size[b]
 
    def set_size(self, a):
        return self.size[self.find(a)]
 
    def __len__(self):
        return self.num_sets



def main():
    n=int(input())
    prod=1
    arr=list(map(int,input().split()))
    arr.sort()
    for i in arr:
        if i==0:
            prod=0
            break
        elif prod>10**18:
            print(-1)
            exit()
        prod*=i

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












    





BUFSIZE = 8192

class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    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("\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()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

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



if __name__ == "__main__":
    main()

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

ans = 1

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

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


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

Solution (Python):

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

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

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

MAX = 10 ** 18
N = int(input())
A = list(map(int, input().split()))
result = 1

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

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

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

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

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

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

print(ans)

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
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):
from sys import stdin

n = int(stdin.readline().rstrip())
al = stdin.readline().rstrip().split()
ans = 1
flag = 0
for a in al:
	ans = ans * int(a)
	if ans < 0 or ans > 1000000000000000000:
		flag = 1
		ans = -1

print(ans)

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

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

ans = 1
for i in lis:
    ans *= i
    if ans >= 10**18:
        break

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

Solution (Python):
def m():  
    N = int(input())
    A = list(map(int, input().split()))
    times = 1
    c = 0

    for i in A: 
        if times <= 10**18 and c < N:
            times *= i
            c += 1   
    if times > 10 ** 18:
        times = -1
    if 0 in A:
        times = 0
    print(times)
m()

Solution (Python):
import sys
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = int(input())
a = inpl()
flag = 0
t = 1
for i in range(0, n):
    if a[i] == 0:
        flag = 1
        print(0)
        break

aaa = 0

if not flag:

    for i in range(0, n):
        t *= a[i]
        if t > 1000000000000000000:
            print(-1)
            aaa = 1
            break
    if not aaa:
        print(t)

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

Solution (Python):
import sys

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

if a_list[-1] == 0:
  print(0)
  sys.exit()

if a_list[0] > 1000000000000000000:
  print(-1)
  sys.exit()

ans = 1
for a in a_list:
  ans *= a

  if ans > 1000000000000000000:
    print(-1)
    sys.exit()

print(ans)

Solution (Python):
from functools import reduce
from operator import mul
l = int(input())
x = list(map(int, input().split()))


result = 1
limit = 10 ** 18
for i in x:
  if result < limit or i == 0:
    result = result * i
if limit < result:
  result = -1
print(result)

Solution (Python):
_ = input()
data = list(map(int, input().split()))
p = 1
m = 10 ** 18

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

for d in data:
  p *= d
  if m < p:
    print(-1)
    exit()
print(p)