peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

if min(a) == 0:
    print(0)
    exit()
else:
    ans = a[0]
    for i in range(1, n, 1):
        ans = ans * a[i]
        if ans > 1e+18:
            print(-1)
            exit()
    print(ans)
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)
N = int(input())

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

A.sort()

res = 1

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

print(res)
N = int(input())
As = list(map(int, input().split()))

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

EL = 1
for i in range(N):
    EL = EL * As[i]
    if EL > 1e+18:
        print(-1)
        exit(0)
print(EL)
def main():
    from heapq import heappop, heappush, heapify

    LIMIT = 10 ** 18

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

    heapify(A)

    if A[0] is 0:
        print(0)
        return

    while len(A) > 1:
        x = heappop(A)
        y = heappop(A)
        heappush(A, x * y)

    ans = heappop(A)
    print(ans if ans <= LIMIT else -1)


if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int, input().split(' '))) 

A.sort()

ans = 1
for a in A:
    ans *= a
    if ans ==0 or ans > 1000000000000000000:
        break
    
if (ans > 1000000000000000000):
    ans = -1

print(ans)
n = int(input())
a = list(map(int,input().split()))
ans=1
bool=True
for i in range(n):
    if a[i]==0:
        bool=False
for i in range(n):
    ans*=a[i]
    if ans>pow(10,18):
        ans=-1
        break
if bool:
    print(ans)
else:
    print(0)
S = int(input())
A=list(map(int, input().split()))
LIMIT = 10**18
if 0 in A:
  print(0)
  exit(0)

ans=1
for i in range(len(A)):
  ans = A[i]*ans
  if ans > LIMIT:
    print(-1)
    exit(0)
print(ans)
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = sorted(nl())
ans = 1
for ele in a:
    ans *= ele
    if ans > 10 ** 18:
        break

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)
N = int(input())
A = [int(i) for i in input().split()]
if min(A) == 0:
    print(0)
    exit()
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
N = int(input())
A= list(map(int, input().split()))
result=1
if 0 in A:
    result = 0
else:
    for t in range(N):
        result *= A[t]
        if result > 10 ** 18:
            result = -1
            break
print(result)
from sys import stdin

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

ans = 1

if 0 in A:
    ans = 0

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

print(ans)
N = int(input())
AS = [int(i) for i in input().split()]

m = 10 ** 18
acc = 1
if 0 in AS:
  print(0)
  import sys
  sys.exit()

for i in AS:
  acc *= i
  if acc > m:
    print('-1')
    import sys
    sys.exit()

print(acc)
n = int(input())
arr = list(map(int, input().split()))

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

prod = 1
for a in arr:
    prod *= a
    if prod > 1000000000000000000:
        print(-1)
        exit(0)

print(prod)
N = int(input())
A = list(map(int, input().split()))
M = pow(10, 18)

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

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

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

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

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

# 整数1個だけ
N = int(input().strip())

# 別変数の整数複数個
A = [int(x) for x in input().strip().split(" ")]
if 0 in A:
    print(0)
    sys.exit(0)

m = 1
l = pow(10, 18)
for a in A:
    m *= a
    if m > l:
        print("-1")
        sys.exit(0)
print(m)
import numpy as np
N = int(input())
A = list(map(int, input().split()))
prod = 1
if 0 in A:
    print(0)
else:
    for i in A:
        prod *=i
        if prod > int(1e18):
            print(-1)
            break
    if prod <= int(1e18):
        print(prod)
N=int(input())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)
if(A[-1]==0):
    print(0)
else:
    ans=1
    flag=0
    for i in range(N):
        ans=ans*A[i]
        if(ans>10**18):
            flag=1
            break
    if(flag==0):
        print(ans)
    else:
        print(-1)
n = int(input())
*a, = map(int,input().split())
a.sort()
MOD = 10**18
ans = 1
if a[0] == 0:
    print(0);exit()
for A in a:
    ans *= A
    if ans > MOD:
        print(-1);exit()
print(ans)
n = int(input())
S = list(map(int,input().split()))
ans = 1

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

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

if min(a) == 0:
    print(0)
    exit()

ans = 1
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
N = int(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)
        exit()
print(ans)
n = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
    print(0)
    exit()
x = 1
for i in a:
    x *= i
    if x > 10**18:
        print(-1)
        exit()
print(x)
import collections
n = int(input())
a = collections.Counter(input().split())
if a["0"]:
    print(0)
    exit()
ans = 1
for i in a:
    ans *= int(i) ** a[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
N=int(input())
A=list(map(int,input().split()))
K=1
if 0 in A:
    print(0)
else:
    for num in A:
        K*=num
        if K>10**18:
            print(-1)
            exit()
    print(K)
n = int(input())
a = input().split()
a.sort()
# print(a)

max_x = 10 ** 18

result = 1
for x in a:
    result *= int(x)
    if result == 0 or result > max_x:
        break

if result > max_x:
    print(-1)
else:
    print(result)
#169B
N=int(input())
As=list(map(int,input().split()))

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

print(num)
import sys

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

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

Π = 1
for _ in A:
    Π *= _
    if(Π > 1000000000000000000):
        print(-1)
        sys.exit(0)

print(Π)
n = int(input())
a = list(map(int,input().split()))
m = 1
if 0 in a:
    print(0)
    exit()
for i in range(len(a)):
    m = m * a[i]
    if m > 10 ** 18:
        print(-1)
        exit()
print(m)
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
N = read_int()
A = read_array()
A.sort()
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > int(1e18):
        print(-1)
        exit()
print(ans)
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])
n = int(input())
a = [i for i in map(int, input().split())]

if a.count(0) != 0:
    print(0)
else:
    result = 1
    for i in range(n):
        result *= a[i]
        if result > (10**18):
            print(-1)
            break
        else:
            continue
    else:
        print(result)
def main():
    n = int(input())
    A = list(map(int, input().split()))

    if 0 in A:
        print(0)
        return

    ans = 1
    for item in A:
        ans = ans * item
        if ans > 1000000000000000000:
            print(-1)
            return

    print(ans)


main()
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)
n = int(input())
l = map(int, input().split())
ans = 1
for a in l:
    if ans * a > 1e18:
        ans = -1
    elif ans != -1 or a == 0:
        ans *= a

print(ans)
N = int(input())
A = input().split()
A = [int(a) for a in A]
A.sort()
MAX = 10**18
res = 1
for i in range(N):
    res *= A[i]
    if res > MAX:
        res = -1
        break
print(res)
N = int(input())
a = list(map(int, input().split()))
count = 1
if 0 in a:
  print(0)
else:
  for i in range(N):
    count *= a[i]
    if count > 10 ** 18:
      print(-1)
      break
  else:
    print(count)
from sys import stdin
input = stdin.readline
def main():
  n = int(input())
  a = list(map(int,input().split()))
  a.sort()
  if a[0] == 0:
    print(0)
    return
  ret = 1
  for i in a:
    ret *= i
    if ret > 10**18:
      print(-1)
      return
  print(ret)
main()
import sys
readline=sys.stdin.readline

N=int(readline())
A=list(map(int,readline().split()))
if 0 in A:
  print(0)
  exit(0)
limit = 10 ** 18

ans = 1
for a in A:
  ans *= a
  if ans > limit:
    print(-1)
    exit(0)
else:
  print(ans)
n = int(input())

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

#print(A)

flag = 0
b = 1

for a in A:
  if a == 0:
    flag = 2

if flag == 0:
  for a in A:
    b = b * a
    if(b > 10**18):
      flag = 1
      break

#if(b > 10**18):
#  flag = 1
  
  
if flag == 1:
  print(-1)
elif flag == 0:
  print(b)
else:
  print(0)
def main():
    num_1 = input()
    lis = list(map(int,input().split()))
    s = 1
    num_2 = int (num_1)
    num = 10 ** 18
    if 0 in lis:
        print(0)
        return
    for x in range(num_2):
        s = s * int(lis[x])
        if s > num:
            print(-1)
            return
    print(s)
    return

main()
import sys

if __name__ == "__main__":
    a = int(input())
    n = list(map(int, input().strip().split(' ')))
    ans = 1
    n.sort()
    for i in n:
      ans *= i
      if ans > 10**18:
          break
    if ans > 10**18:
        print(-1)
    else:
        print(ans)
import sys

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

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

ans = 1

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

print(ans)
def resolve():
    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)
resolve()
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N = int(input().strip())
    A_list = [int(i) for i in input().strip().split()]
    max = 10 ** 18
    ans = 1
    if 0 in A_list:
        return 0

    for A in A_list:
        ans *= A
        if ans > max:
            return -1
    return ans


if __name__ == "__main__":
    print(main())
input = raw_input

n = int(input())
As = map(int, input().split(" "))

if 0 in As:
    out = 0
else:
    m = 10 ** 18 
    for i, a in enumerate(As):
        if a > m:
            out = -1
            break

        if i == 0:
            out = a
        else:
            out *= a

        if out > m:
            out = -1
            break

print(out)
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)
N = int(input())
l = list(map(int, input().split()))

res = 1
check = 10**18
flag = 0 in l

for e in l:
    res *= e
    if res > check:
        if flag:
            res = 0
        else:
            res = -1
        break

print(res)
n = int(input())
b = input()
a = [int(i) for i in b.split()]

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

if ans :
    for i in range(n):
        ans *= a[i];
        if ans > 1000000000000000000 :
            ans = -1
            break
        
print(ans)
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)
n = int(input())
A = [int(i) for i in input().split()]
check = [i for i in A if i == 0]
if 0 in check:
    print(0)
else:   
    A.sort(reverse=True)
    work = 1
    for a in A:
        work *= a
        if work > 10**18:
            print('-1')
            break
    else:
        print(work)
import numpy as np
from sys import stdin


def get_result(data):
    A = sorted(data[1])
    ans = 1
    for val in A:
        ans = ans * val
        if ans > 10**18:
            ans = -1
            break
        elif ans == 0:
            ans = 0
            break
    return ans


if __name__ == '__main__':
    raw_data = [val.rstrip() for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)
import sys

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

ans=1
if 0 in m:
  print(0)
  sys.exit()

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

if ans<=pow(10,18):
  print(ans)
import sys
n = int(input())
a = list(map(int, sys.stdin.readline().split()))

a.sort(reverse=True)

if a[-1] == 0:
    print(0)
else:
    limit = 10**18
    prod = 1
    for one in a:
        prod *= one
        if prod > limit:
            print(-1)
            break
    else:
        print(prod)
def main():
    n = int(input())
    a = list(map(int, input().split()))
    if 0 in a:
        print(0)
        return
    prod = 1
    for i in a:
        prod *= i
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main()
def main():
    input()
    a=input().split()
    if "0" in a:
        print(0)
        return
    s=1
    for i in a:
        s*=int(i)
        if s>1e+18:
            print("-1")
            return
    else:
        print(s)
    return
if __name__ == "__main__":
    main()
N = int(input())
A = list(map(int,input().split()))

tmp = 1

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

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


print(tmp)
def main():
  n = int(input())
  values = list(map(int, input().split()))
  if 0 in values:
    print(0)
    return

  mult = 1
  for i in values:
    mult *= i
    if mult > 1000000000000000000:
      print(-1)
      return
  print(mult)

main()
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)
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)
N = int(input())
*A, = map(int, input().split())
if 0 in A:
    print(0)
    exit()
ans = A[0]

for i in A[1:]:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
        break

print(ans)
# -*- coding: utf-8 -*-
from decimal import Decimal
# input
n = int(input())
a = list(map(int, input().split()))
out = 1
if 0 in a:
    print(0)
    quit()
for i in range(n):
    out = Decimal(out * a[i])
    if out > Decimal(10**18):
        print(-1)
        quit()
print(out)
n = int(input())
A = [int(i) for i in input().split()]

if any([a == 0 for a in A]):
    print(0)
    exit()

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

print(ans)
import numpy as np
n=int(input())
a=list(map(int,input().split()))
ans=1
if 0 in a:
    print(0)
    exit()
for i in range(n):
    ans=ans*a[i]
    if ans>10**18 and not 0 in a:
      print(-1)
      exit()
if ans>10**18:
    anscheck=False
else:
    anscheck=True
print(ans if anscheck else -1)
n = int(input())
l = list(map(int, input().split()))
if 0 in l:
  print(0)
  exit()
ans = 1
for i in range(n):
  ans *= l[i]
  if ans > 10**18:
    ans = -1
    break
print(ans)
n = int(input())
a = list(map(int,input().split()))
a.sort()
if(a[0]==0): print(0)
else:
    s = 1
    for i in range(n):
        s*=a[i]
        if s>10**18:
            print(-1)
            break
    else: print(s)
import sys

n= int(input())
a = list(map(int,input().split()))
a.sort()
ans_max = 10 ** 18

ans = a[0]
for i in range(1, n):
    ans *= a[i]
    if ans > ans_max:
        print("-1")
        sys.exit()

print(ans)
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)
import sys
N = int(input())
A = list(map(int, input().split()))
if min(A) == 0:
    print(0)
    sys.exit(0)

ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 10**18:
        print(-1)
        sys.exit(0)
print(ans)
s = list(map(int, input().split()))
s = list(map(int, input().split()))
ans = 1
if 0 in s:
    print(0)
else:
    for i in s:
        ans *= i
        if ans > 10**18:
            break
    if ans > 10**18:
        print(-1)
    else:
        print(ans)
n = int(input())
a = tuple(map(int,input().split()))
ans = 1
for ai in a:
  if ai == 0:
    print(0)
    exit()
for ai in a:
  ans *= ai
  if ans > 10**18:
    print(-1)
    exit()
print(ans)
n = int(input())
a = list(map(int, input().split()))
ans = 1

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

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

if flag == 1 and (0 not in a):
    ans = -1
if 0 in a:
    ans = 0

print(ans)
import sys
import math
#import random
#sys.setrecursionlimit(100000000)
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

n=inp()
ara=inara()
for num in ara:
	if num==0:
		print(0)
		exit(0)

ans=1
for num in ara:
	ans*=num
	if ans>1000000000000000000:
		print(-1)
		exit(0)

print(ans)
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
x = 1
for v in a:
    x = x * v
    if x > 1000000000000000000:
        x = 1000000000000000001
if x > 1000000000000000000:
    print(-1)
else:
    print(x)
n = int(input())
a = sorted(map(int, input().split()))

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

else:
    print(ans)
N=input()
S=input().split()
buf=-2
for n,i in enumerate(S):
  if i=="0":
    buf=0
if buf!=0:
  for n,i in enumerate(S):
    if n==0:
      buf=int(i)
    else:
      buf=buf*int(i)
    if buf>1000000000000000000:
      buf=-1
      break
print(buf)
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        exit()
    mul = A[0]
    for v in A[1:]:
        mul *= v
        if mul > 10**18:
            print(-1)
            exit()
    print(mul)





if __name__ == '__main__':
    solve()
num = int(input())
numbers = list(map(int,input().split()))
sum = 1
for i in range(num):
  sum *=numbers[i]
  if (sum>(10**18)):
    sum = -1
    break
if 0 in numbers:
  sum = 0
print (sum)
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)
N = int(input())
A = list(map(int, input().split()))

sums=1
for i in A:
    sums=sums*i
    if sums>1000000000000000000:
        sums=-1
        break
    
if 0 in A:
    print(0)
else:
    print(sums)
n = int(input())
num = list(map(int,input().split(" ")))
 
zero=num.count(0)
z= 10 **18
if zero != 0:
  print(0)
else:
  s = num[0]
  for i in range(1,n):
    s = s * num[i]
    if s > z:
      s=-1
      break
  print(s)
#!/usr/bin/env python3
import sys
from itertools import chain

MAX = 10 ** 18


def solve(N: int, A: "List[int]"):
    A = sorted(A)
    answer = 1
    for a in A:
        answer *= a
        if answer > MAX:
            return -1
    return answer


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    # N, A = map(int, line.split())
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    answer = solve(N, A)
    print(answer)


if __name__ == "__main__":
    main()
n = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in set(A):
    print(0)
    exit()
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
N=int(input())
A=list(map(int,input().split()))
sorted(A)
result=1
if 0 in A:
    result=0
for i in A:
    if result==0:
        break
    result*=i
    if result>1000000000000000000:
        result=-1
        break

print(result)
n=int(input())
l=list(map(int, input().split()))
val=0
ans=1
num=10**18
if 0 in l:
    print(0)
else:
    for i in l:
        l1=len(list(str(ans)))
        l2=len(list(str(i)))
        if l1+l2>20:
            val=1
            break
        ans=ans*i
        if ans>num:
            val=1
            break
    if val==1:
        print(-1)
    else:
        print(ans)
n=int(input())
A=list(map(int, input().split()))
t=1
A.sort()
if A[0]==0:
    print(0)
    exit()
A.reverse()
for i in range(n):
    t*=A[i]
    if t>1000000000000000000:
        print(-1)
        exit()
print(t)
limit=10**18
n=int(input())
A=list(map(int,input().split()))
ans=1
if 0 in A:
  ans=0
else:
  for a in A:
    ans*=a
    if ans > limit:
      ans=-1
      break
print(ans)
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()
n = int(input())
num_list = list(map(int,input().split()))
ans = 1
if 0 in num_list:
    print(0)
    
else:
    for i in num_list:
        ans *= i
        if ans > 10**18:
            break

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

    else:
        print(ans)