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

answer=1
for a in As:
    answer=answer*a
    answer=min(answer, 10**18+1)

if answer==10**18+1:
    answer=-1

print(answer)

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

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import deque
import sys
n = int(input())

a = list(map(int,input().split()))
a.sort()
if(a[0] == 0):
    print("0")
    sys.exit()
ans = 1
for i in range(n):

    ans = ans * a[i]
    if(ans > 10**18):
        print("-1")
        sys.exit()
     




print(ans)

Solution (Python):
N = int(input())
A_n = list(map(int, input().split(' ')))
zero = 0 in A_n
if zero:
    total = 0
else:
    total = 1
    for i in A_n:
        total *= i
        if total > 10 ** 18:
            total = -1
            break
print(total)

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

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

for ele in a:
    ans = ans * ele
    if ans > max:
        print('-1')
        exit()

print(ans)

Solution (Python):
n = int(input())
A = [*map(int,input().split())]
inf = 10**18 + 1
ans = 1
for a in A: ans = min(ans*a, inf)
if ans == inf: ans = -1
print(ans)

Solution (Python):
BIG = 10 ** 18
_ = input()
ans = 1
A = list(map(int, input().split()))

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

print(ans)

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

num = 1

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

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

print(num)

Solution (Python):
from sys import exit
n = int(input())
a = [int(i) for i in input().split()]
number =1

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

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

print(number)

Solution (Python):

import sys
from math import sqrt
input = sys.stdin.readline

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

MAX = 10**18
n = inp()
a = inlt()
if 0 in a:
    print(0)
    exit()
res = 1
for num in a:
    res*=num
    if res > MAX:
        print(-1)
        exit()
print(res)

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

  prod = 1
  for a in A:
      prod *= a
      if prod > 1000000000000000000:
          print(-1)
          return
  print(prod)

main ()

Solution (Python):



def main():
    n = int(input())
    A = list(map(int, input().split()))
    MOD = 10 ** 18
    ans = 1
    if 0 in A:
        print('0')
        return
    for i in range(n):
        ans *= A.pop(0)
        if ans > MOD:
            print('-1')
            return
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
_, *a = map(int, open(0).read().split())
ret = 1
for x in sorted(a):
  ret *= x
  if ret > 10 ** 18:
    ret = -1; break
    
print(ret)

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

print(a)

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

Solution (Python):
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return
	print(prod)
main ()

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

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

Solution (Python):
from operator import mul
from functools import reduce
N, *A = map(int, open(0).read().split())

while len(A) > 1:
  n = len(A)
  if n & 1:
    A.append(1)
    n += 1
  L, R = A[:n//2], A[n//2:]
  A = [x * y for x, y in zip(L, R)]
x = A[0]
if x > 10 ** 18:
  x = -1
print(x)

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

Solution (Python):
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  
  if 0 in A:
    print(0)
    return
  
  prod = 1
  
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  print(prod)
              
main ()

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

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

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

  if 0 in a:
    print(0)
    return

  prod = 1
  for a in a:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  
  print(prod)
  
main()

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

seki = 1

a.sort()
if a[0] == 0:
	print(0)
	exit()
else:
	for i in range(N):
		seki = seki * a[i]
		if seki > 1e18:
			print(-1) 
			exit()
print(seki)

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

Solution (Python):
t=1;print([t:=(-1,t:=t*int(a))[0<=t<=1e18]for a in[*open(0)][1].split()][-1])

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

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

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

  if 0 in A:
    print(0)
    return

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

  print(p)
main()

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

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

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

print(mul)

Solution (Python):
n = int(input())
list = input().split(" ")

if '0' in list:
    print(0)
    exit()

x = 1
for i in list:
    x = x * int(i)
    if x > 10**18:
        print(-1)
        exit()
print(x)

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

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

Solution (Python):
t=1;print([t:=(-1,t:=t*int(a))[0<=t<=1e18]for a in[*open(0)][1].split()][-1])

Solution (Python):












N = int(input()) 

arg = list(map(int, input().split())) 
m = 1

if 0 in arg:
  print(0)
else:
  for A in arg:
    m = A * m
    if m > 1000000000000000000:
      m = -1
      break;
  print(m)

Solution (Python):
t=1;[t:=(-1,t:=t*int(a))[0<=t<=1e18] for a in[*open(0)][1].split()];print(t)

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

  if 0 in A:
    print(0)
    return
  
  num = 1
  max_num = 10**18
  for i in A:
    num *= i
    
    if num > max_num:
      print(-1)
      return
  
  print(num)
  
main()

Solution (Python):
INF = int(1e18)


def main():
    N, *A, = map(int, open(0).read().split())
    ans = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        ans *= a
        if INF < ans:
            print(-1)
            break
    else:
        print(ans)
    return


main()

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

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

    if 0 in A:
        print(0)
        return

    anser = 1
    for a in A:
        anser *= a
        if anser > 1000000000000000000:
            print(-1)
            return

    print(anser)

main()

Solution (Python):
"""
    This template is made by Satwik_Tiwari.
    python programmers can use this template :)) .
"""



from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter  
from itertools import combinations as comb 
from itertools import permutations as permutate
from bisect import bisect_left as bl


from bisect import bisect_right as br
from bisect import bisect






mod = 1000000007
def inp(): return sys.stdin.readline().strip() 
def out(var): sys.stdout.write(str(var))  
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())
def graph(vertex): return [[] for i in range(0,vertex+1)]
def zerolist(n): return [0]*n
def nextline(): out("\n")  
def testcase(t):
    for p in range(t):
        solve()
def printlist(a) :
    for p in range(0,len(a)):
        out(str(a[p]) + ' ')
def lcm(a,b): return (a*b)//gcd(a,b)





def solve():
    n = int(inp())
    a = lis()
    ans = 1
    if(a.count(0)>0):
        print(0)
    else:
        ans = 1
        f = False
        for i in range(0,n):
            ans*=a[i]
            if(ans > (10**18)):
                f = True
                break
        if(f):
            print(-1)
        else:
            print(ans)

testcase(1)

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):
n=int(input())
a=list(map(int,input().split()))
a.sort()

x=1

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

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

Solution (Python):
count = int(input())
nums = input().split(" ")

product = 1

if ("0" in nums):
    print(0)
else:
    for i in nums:
        product *= int(i)
        if (product > 10**18):
            print(-1)
            exit()
    print(product)

Solution (Python):
n = input()
a_array = input().split(' ')

seki = 1
end = False

if "0" in a_array:
    print(0)
else:
    for a in a_array:
        a = int(a)
        seki *= a

        if seki > 10**18:
            print(-1)
            end = True
            break

    if end == False:
        print(seki)

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

A.sort()

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

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

print(ans)

Solution (Python):

import sys


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

INF = 2**62-1


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


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


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


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


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


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

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


def mt(f):
    import time

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

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

    return wrap


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


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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
A = [*map(int,input().split())]
ans = 1
for a in A:
    ans *= a
    ans = min(ans, 10**18 + 1)
if ans == 10**18 + 1: ans = -1
print(ans)

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

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

print(ans)

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

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

main()

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

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1e18:
            print(-1)
            return

    print(prod)

main()

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

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

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

A = sorted([int(i) for i in input().split()],reverse=True)

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

x = A[0]  
for i in A[1:]:
  x *= i
  if x > 10**18:
    print('-1')
    exit();
    
print(x)

Solution (Python):


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

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

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)

main(A)

Solution (Python):
x1 = input()
x2 = [int(i) for i in input().split(" ")]

result = 0
if 0 in x2:
  None 
else:
  result = 1
  for xv in x2:
     result = xv * result
  
     if 10**18 < result : 
        result = -1
        break


print(result)

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

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

ans = 1
for d in data:
    ans *= d
    if ans > 10**18:
        ans = -1
        break

print(ans)

Solution (Python):
t=1
for a in[*open(0)][1].split():t*=int(a);t=(-1,t)[0<=t<=1e18]
print(t)

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

Solution (Python):
t=1
for a in[*open(0)][1].split():t=(-1,t:=t*int(a))[0<=t<=1e18]
print(t)

Solution (Python):
t=1
for a in sorted([*open(0)][1].split()):t=(-1,t:=t*int(a))[0<=t<=1e18]
print(t)

Solution (Python):
N = int(input())
count = 1
inputs = [int(i) for i in input().split()]
if 0 in inputs:
    print(0)
    quit()
else:
    for daude in inputs:
        if daude > 10 ** 18:
            count = -1
            break
        count *= daude
        if count > 10 ** 18:
            count = -1
            break
    print(count)

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

Solution (Python):
def main():
  n = int(input())
  ls = list(map(int, input().split()))
  if 0 in ls:
      print(0)
      return
  ans = 1
  for l in ls:
      ans *= l
      if ans > 1e18:
          print(-1)
          return
  print(ans)
  
main()

Solution (Python):
def main():
  n = int(input())
  ls = list(map(int, input().split()))
  if 0 in ls:
    print(0)
    return
  ans = 1
  for l in ls:
    ans *= l
    if ans > 1e18:
      print(-1)
      return
  print(ans)
  
main()

Solution (Python):
def main():
  n = int(input())
  ls = list(map(int, input().split()))
  if 0 in ls:
    print(0)
    return
  ans = 1
  for l in ls:
    ans *= l
    if ans > 1000000000000000000:
      print(-1)
      return
  print(ans)
  
main()

Solution (Python):
import sys

 
def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    
    n = int(read())
    a = list(map(int,read().split()))
    ans = 1
    flag = True
    iszero = any(num == 0 for num in a)
    if iszero: print(0)
    else:
        for num in a:
          ans *= num
          if ans > 10**18:
            flag = False
            break
        print(ans if flag else -1)
 
if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]




from decimal import Decimal
'''
N = ii()
A = li()
ans = 1
for num in A:
    ans *= num
    if ans > 10**18:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)
'''

'''
N = ii()
A = li()
ans = 1
inf = Decimal('1000000000000000000')
for num in A:
    if ans <= inf / Decimal(str(num)):
        ans *= num
    else:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()
print(ans)
'''


N = ii()
A = li()
if 0 in A:
    print(0)
    exit()
ans = 1
for num in A:
    
    
    if ans <= 10**18//num:
        ans *= num
    else:
        print(-1)
        exit()
print(ans)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]




from decimal import Decimal
'''
N = ii()
A = li()
ans = 1
for num in A:
    ans *= num
    if ans > 10**18:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)
'''

'''
N = ii()
A = li()
ans = 1
inf = Decimal('1000000000000000000')
for num in A:
    if ans <= inf / Decimal(str(num)):
        ans *= num
    else:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()
print(ans)
'''

N = ii()
A = li()
if 0 in A:
    print(0)
    exit()
ans = 1
for num in A:
    if ans < (10**18+1) / num or ans == 10**18//num:
        ans *= num
    else:
        print(-1)
        exit()
 
print(ans)

Solution (Python):
import numpy as np
import sys
import collections

N = int(input())
A = list(map(int, input().split()))
res = 1
if 0 in A:
    print(0)
    sys.exit()
for i in range(N):
    res *= A[i]
    if res > 1e18:
        print(-1)
        sys.exit()
print(res)

Solution (Python):
n = int(input())
a = map(int, input().split())
a = sorted(a)
s = 1
for x in a:
    s *= x;
    if s > 1e18:
        print(-1)
        exit()
print(s)

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]




from decimal import Decimal
'''
N = ii()
A = li()
ans = 1
for num in A:
    ans *= num
    if ans > 10**18:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)
'''

N = ii()
A = li()
ans = 1
inf = Decimal('1000000000000000000')

for num in A:
    if ans <= inf / Decimal(str(num)):
        ans *= num
    else:
        if 0 in A:
            print(0)
        else:
            print(-1)
        exit()

print(ans)

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

print(main())

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

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

a = list(map(int, input().split()))
hasZero = False
for x in a:
    if x == 0:
        hasZero = True
if hasZero:
    print(0)
    exit(0)
res = 1
limits = 10**18
for x in a:
    res *= x
    if res > limits:
        res = -1
        break
print(res)

Solution (Python):
def main():
    N = int(input())
    A =list(map(int,input().split()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)

main()

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

limit = 10 ** 18

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

flg = True
if l[0] == 0:
    flg = False
    print(0)
else:
    ans = 1
    for i in l:
        if ans > limit:
            print(-1)
            flg = False
            break
        else:
            ans *= i
            
if flg:
    print(ans if ans <= limit else -1)

Solution (Python):
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
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):
  
   
   
  ans*=A[i]
  if ans>10**18:
    print(-1)
    exit()
print(ans)

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

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


if __name__ == "__main__":
  main()

Solution (Python):

N=int(input())
sA=input().split(" ")
A=[]

for i in range(N):
    A.append(int(sA[i]))

flag=False

zero=False
th=pow(10,18)
for i in range(N):
    if(A[i]==0):
        zero=True
        break
    elif(A[i]>th):
        flag=True
        break

S=1
for i in range(N):
    S*=A[i]
    if(S>th):
        flag=True
        break

if(zero):
    print(0)
else:
    if(flag):
        print(-1)
    else:
        print(S)

Solution (Python):
import math
n=input()
a=list(map(int,input().split()))
a.sort()
x=pow(10,18)
s=int(1)
c=True
for i in a:
	s*=i
	if(s>x):
		print('-1')
		c=False
		break
if c:
	print(s)

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

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

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

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

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

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

print(ans)

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

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

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

Solution (Python):
n=int(input(""))
k=1

li=input().split(" ")
if '0' in li:
    print("0")
else:
    for i in li:
        k*=int(i)
        if k>1000000000000000000:
            print("-1")
            break
    else:
        print(k)

Solution (Python):
n=int(input(""))
k=1
li=list(map(int,input("").split(" ")))
if 0 in li:
    print("0")
else:
    for i in li:
        k*=int(i)
        if k>1000000000000000000:
            print("-1")
            break
    else:
        print(k)

Solution (Python):


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

    a.sort()
    res = 1
    for i in range(n):
        res *= a[i]
        if (res > 1000000000000000000):
            print(-1)
            return 0
    print(res)

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

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

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

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

print(ans)

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

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

print(ans)

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

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

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

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

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

    total = 1

    if 0 in a :
        print(0)
        return

    for i in a :
        total *= i

        if total > 10 ** 18 :
            print(-1)
            return

    print(total)

if __name__ == "__main__" :
    solve()

Solution (Python):


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

flag = 1

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

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

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

    total = 1

    if 0 in a :
        print(0)
        return

    for i in a :
        total *= i

        if total > 10 ** 18 :
            print(-1)
            return

    print(total)

if __name__ == "__main__" :
    solve()