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






"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import os
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from io import BytesIO, IOBase
from typing import Dict, List, Optional, Set, Tuple

MAX = pow(10, 18)


def solve(values: List[int]) -> int:
    if 0 in set(values):
        return 0
    prod = 1
    for v in values:
        prod *= v
        if prod > MAX:
            return -1
    return prod


def do_job(stdin, stdout):
    "Do the work"
    LOG.debug("Start working")
    
    _N = int(stdin.readline().strip())
    values = list(map(int, stdin.readline().split()))
    
    
    
    result = solve(values)
    print(result, file=stdout)


def print_output(testcase: int, result, stdout) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case 
    
    


BUFSIZE = 8192


class FastIO(IOBase):
    
    newlines = 0

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

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

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

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


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


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("L%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(IOWrapper(sys.stderr))
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None

if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    stdin = IOWrapper(sys.stdin)
    stdout = IOWrapper(sys.stdout)
    do_job(stdin, stdout)
    stdout.flush()
    for h in LOG.handlers:
        h.flush()
    return 0


if __name__ == "__main__":
    sys.exit(main())

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:
        print(-1)
        exit(0)

print(ans)
exit(0)

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

A.sort()

ans=1
for i in A:
    ans*=i
    if ans>limit:
        print(-1)
        break
else:
    print(ans)

Solution (Python):
N=int(input())
A=[int(x) for x in 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)
            break
    if ans<=10**18:
        print(ans)

Solution (Python):
def main():
    n = int(input())
    A = [int(e) for e in input().split()]

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

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

    print(ans)


if __name__ == '__main__':
    main()

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

res = 1
for a in A:
    res *= a
    if res > pow(10, 18):
        print(-1)
        exit()
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):
    ans *= a[i]
    if ans > 10**18:
      ans = -1
      break
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue



ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()

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

    ret = 1
    for n in range(N):
        ret *= A[n]
        if ret > 10 ** 18:
            print(-1)
            exit()
    else:
        print(ret)


if __name__ == '__main__':
    main()

Solution (Python):

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

Solution (Python):
import sys

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

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

Solution (Python):
import sys

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


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

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

answer=1
for a in alist:
  answer*=a
  if answer==0:
    print(0)
    break
  elif answer>10**18:
    print(-1)
    break
else:
  print(answer)

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

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

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


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

Solution (Python):
"""    Arnab Chanda    """

from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import heapq

int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline().split()
multi_int_input =lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input=lambda : list(map(int,stdin.readline().split()))
string_list_input=lambda: list(string_input())
MOD = pow(10,9)+7


n = int_input()

a = list_input()

MAX = pow(10, 18)
flag = True
p = 1

for i in a:
    if i == 0:
        p = 0
        break

for i in a:
    p = p*i
    
    if (p > MAX):
        flag = False
        break


if flag == True:
    print(p)
else:
    print(-1)

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

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

Solution (Python):
import sys
n = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    sys.exit()
ans = 1
for i in 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()))
INF=1e18
ans=1
if(0 in a):print(0)
else:
    for i in a:
        ans*=i
        if(INF<ans):
            ans=-1
            break
    print(ans)

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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Solution (Python):
inpl = lambda: list(map(int,input().split()))
N = int(input())
A = inpl()
ans = 1
bound = 10**18
A.sort(reverse=True)
if A[-1] == 0:
    print(0)
else:
    for a in A:
        ans *= a
        if ans > bound:
            print(-1)
            break
    else:
        print(ans)

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

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

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

A.sort()

ans = A[0]

for i in range(N):
    if i == 0:
        continue
    ans = ans * A[i]
    if ans > 1000000000000000000:
        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:
        print(-1)
        exit()
print(Ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
for aa in a:
  if aa==0:
    print(0)
    exit(0)

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

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

A.sort()
ans=1
maximum=10**18
for a in A:
  if a==0:
    print(0);exit()
  ans*=a
  if ans>maximum:
    print(-1);exit()
print(ans)

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

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

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 > 10 ** 18):
        print(-1)
        exit()
        break

print(ans)

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

if a[0] == 0:
    print(0)
    exit()
else:
    ans = a[0]
    for i in range(1, len(a)):
        ans *= a[i]
        if ans > 10**18:
            print("-1")
            exit()
    
    
    print(ans)

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

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())
nums = [int(i) for i in input().split()]

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

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

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

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

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

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

    return i

print(main())

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

MAX=pow(10,18)

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

Solution (Python):
def main(n: int, a: list):
    if 0 in a:
        print(0)
        return

    ans = a[0]

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

    print(ans)


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

    main(n, a)

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
ans=1
t=0
if 0 in A:
 print(0)
else:
 while ans<=10**18 and t<N:
  ans*=A[t]
  t+=1
 if ans<=10**18:
  print(ans)
 else:
  print(-1)

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

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

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

Solution (Python):




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

ans = 1
if l.count(0) != 0:
    print(0)
    exit()
for i in range(n):
    ans *= l[i]
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

if len(list(filter(lambda v : v == 0, A))) > 0:
    print(0)
else:

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

    print(x)

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

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

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

if __name__ == '__main__':
    main()

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

ans = 1
border = pow(10, 18)
ng = 0
if 0 in A:
    print(0)
    ng = 1

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

if ng == 0:
    print(ans)

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

if a.count(0) > 0:
    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):
import sys
n = int(input())
a = sorted(list(map(int, input().split())))

res = 1
for t in a:
    res *= t
    if res > 10**18:
        print(-1)
        sys.exit()
    if res == 0:
        print(res)
        sys.exit()
else:
    print(res)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
ans = 1
check = 0
for i in A:
    ans *= i
    if ans > 10**18:
        check += 1
        break
        
if min(A)==0:
    print("0")
elif check>0:
    print("-1")
else:
    print(ans)

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

border = pow(10, 18)

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

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

print(ans)

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

limit = 10 ** 18
A.sort()
ans = 1
for a in A:
    ans *= a
    if ans > limit:
        ans = -1
        break

print(ans)

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

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

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

Solution (Python):
import sys, random, math
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
    inf = 10 ** 20



    t = 1
    
    for _ in range(1, t+1):
    
        
        n = int(input())
        ans = 1
        for x in sorted([int(x) for x in input().split()]):
            ans *= int(x)
            if(ans > 1e18):
                ans = -1
        
                break
        
        print(ans)
        
main()

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

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

Solution (Python):
def task(n, a):
    for value in a:
        if value == 0:
            print(0)
            return

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

    print(ans)


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

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

A.sort()
result = 1

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

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
A = getList()

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

Solution (Python):
def solve(n, a_list):
    res = 1
    if 0 in a_list:
        return 0
    for i in range(n):
        res *= a_list[i]
        if res > 10 ** 18:
            return -1
    return res


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    res = solve(n, a_list)
    print(res)


def test():
    assert solve(2, [1000000000, 1000000000]) == 1000000000000000000
    assert solve(3, [101, 9901, 999999000001]) == -1
    assert solve(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]) == 0


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

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

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

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 > 1e18:
    print(-1)
    exit()
    
print(ans)

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

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

Solution (Python):
from math import sqrt,gcd,ceil 
def ii():return int(input())
def mi():return map(int,input().split())
def li():return list(mi())
def si():return input()

n=ii()
a=li()
s=1
if 0 in a:
    print(0)
    exit(0)
for i in a:
    s*=i
    if(s>1e18):
        break
if(s>1e18):
    s=-1
print(s)

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

t = 10 ** 18

n = INT()
a = LIST()
ans = 1
a.sort(reverse=True)
if a[-1] == 0:
    print(0)
    exit()
for i in a:
    ans *= i
    if ans > t:
        print(-1)
        exit()
print(ans)

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

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

limit = int(1e18)

answer = 1

over = False

for a in a_i:
    answer *= a
    if answer > limit:
        over = True
        break

if min(a_i) == 0:
    over = False
    answer = 0

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

Solution (Python):






def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp


def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a, a)


def nCr(n, k): 
    if(k > n - k): 
        k = n - k 
    res = 1
    for i in range(k): 
        res = res * (n - i) 
        res = res / (i + 1) 
    return int(res) 


def upper_bound(a, x, lo=0):
    hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x:
            lo = mid+1
        else:
            hi = mid
    return lo


def primefs(n):
    
    primes = {}
    while(n%2 == 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    
    
    return primes


def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 


def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b









def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;




def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x


def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime


MAXN = int(1e6 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    




def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret
    
    


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

def str_array():
    return input().strip().split();


MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');



n = int(input()); a = sorted(int_array());
ans = 1; f = 1;
for i in a:
    ans *= i;
    if ans > int(1e18):
        f = 0; break;
if f:
    print(ans);
else:
    print(-1);

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


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

judge = False

for e in a:
    if e == 0:
        judge = True
if judge:
    print(0)
    exit()

res = 1
for e in a:
    res = res*e
    if res > 10**18:
        res = -1
        break


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

Solution (Python):



N = int(input())
A = [int(_) for _ in input().split()]

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

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

print(ans)

Solution (Python):
from math import *
from sys import stdin,stdout
input=stdin.buffer.readline

n=int(input())
a=[int(x) for x in input().split()]
a.sort()
m=1
flag=1
for i in range(n):
	m=m*a[i]
	if(m>1000000000000000000):
		flag=0
		break
if flag==1:
	print(m)
else:
	print(-1)

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

print(ans)
exit()

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

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

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

f = True
for i in A:
  if i == 0:
    print(0)
    f = False
    break

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

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

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

ans = 1

for x in a:
    ans *= x
    if ans > 1000000000000000000:
        break

for x in a:
    if x == 0:
        ans = x

if ans > 1000000000000000000:
    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 i in a:
    ans *= i
    if ans > m:
        print(-1)
        exit()
print(ans)

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

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


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

n,*A = get_all_int()

if min(A) == 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()))

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

Solution (Python):
from math import *


n = int(raw_input())
seq = map(int, raw_input().split())

total = 1

has_zero = False

for x in seq:
    if x == 0:
        has_zero = True


limit = int(10 ** 18)

if has_zero == True:
    print(0)
else:
    big = False
    for x in seq:
        total = total * x
        if total > limit:
            big = True
            break
    if big == True:
        print(-1)
    else:
        print(total)

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

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

total = 1
siki = 10**18
if al.count(0) >= 1:
  print(0)
else:
  for i in al:
    total *= i
    if total > siki:
      print(-1)
      break
  else:
    print(total)

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

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

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

print(ans)

Solution (Python):
p = int(input())
nums = list(map(int, input().split()))

ans = 1
large = False
for i in nums:
    if i == 0:
        ans = 0
        large = False
    if not large:
        ans = ans * i
        if ans > 10 ** 18:
            large = True
    else:
        pass

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]

n = int(input())
a_li = list(map(int, input().split()))
if 0 in a_li:
    print(0)
else:
    res = a_li[0]
    for x in a_li[1:]:
        res *= x
        if res > 10**18:
            print(-1)
            break
    else:
        print(res)

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