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-----
2
1000000000 1000000000

-----Sample Output-----
1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Difficulty: EASY

Solutions:
N = int(input())
A = [int(x) for x in input().split()]
x = 1
P = 10 ** 18
if 0 in A:
	x = 0
else:
	for a in A:
		x *= a
		if x > P:
			x = -1
			break
print(x)


import math

def main():
	n = int(input())
	aList = list(map(int, input().split()))
	sumA = 1
	if aList.count(0) > 0:
		print(0)
		return
	for a in aList:
		sumA *= a
		if sumA > 10 ** 18:
			print(-1)
			return
	print(sumA)

def __starting_point():
	main()
__starting_point()


N = int(input())
A = list(map(int, input().split()))
const = 10 ** 18
if 0 in A:
	print(0)
	return
result = 1
for i in A:
	result *= i
	if result > const:
		print(-1)
		return
print(result)


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


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


n = input()
A = list(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)


n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
for e in a:
	ans *= e
	if ans > 10 ** 18:
		ans = -1
		break
print(ans)


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


(N, *A) = map(int, open(0).read().split())
b = 1
A = sorted(A)
for a in A:
	if b > 10 ** 18:
		break
	b *= a
print(-1 if b > 10 ** 18 else b)


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


i = input
i()
l = i().split()
x = 1 - ('0' in l)
for j in l:
	x *= int(j)
	if x > 1e+18:
		print(-1)
		quit()
print(x)


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


input()
a = 1
d = eval('1' + '0' * 18)
for i in input().split():
	a = min(a * int(i), d + 1)
print([a, -1][a > d])


a = 1
for i in [*open(0)][1].split():
	a *= int(i)
	a = [-1, a][-1 < a <= 1e+18]
print(a)


N = int(input())
l = list(map(int, input().split()))
a = 1
l.sort()
for i in range(N):
	a = a * l[i]
	if a > 10 ** 18:
		print(-1)
		break
if a <= 10 ** 18:
	print(a)


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


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


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
x = int(1)
for i in arr:
	x = x * i
	if x > 1e+18:
		x = -1
		break
print(x)


n = int(input())
aa = list(map(int, input().split()))
if 0 in aa:
	print('0')
	return
result = 1
for a in aa:
	result *= a
	if result > pow(10, 18):
		print('-1')
		return
print(result)


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


(_, *a) = map(int, open(0).read().split())
a.sort()
ans = 1
for i in a:
	ans *= i
	if ans > 10 ** 18:
		ans = -1
		break
print(ans)


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


import sys
N = int(input())
lsA = list(map(int, input().split()))
if 0 in lsA:
	print(0)
	return
ans = 1
for i in range(N):
	ans *= lsA[i]
	if ans > 10 ** 18:
		print(-1)
		return
print(ans)


n = int(input())
A = list(map(int, input().split()))
A.sort()
ans = int(1)
for i in range(n):
	ans *= A[i]
	if ans > 1e+18:
		print(-1)
		return
print(ans)


(n, *l) = map(int, open(0).read().split())
from heapq import *
heapify(l)
while len(l) > 1:
	heappush(l, heappop(l) * heappop(l))
print([l[0], -1][l[0] > 10 ** 18])


N = int(input())
A = list(map(int, input().split()))
if 0 in A:
	print(0)
	return
product = 1
for num in A:
	product = product * num
	if product > 10 ** 18:
		print(-1)
		return
print(product)


_ = input()
A = sorted(list(map(int, input().split())))
B = 1
for a in A:
	B *= a
	if B > 10 ** 18:
		B = -1
		break
print(B)


input()
a = [int(i) for i in input().split(' ')]
p = 1
for i in a:
	p *= i
	if p > 10 ** 18:
		p = 10 ** 18 + 1
if p > 10 ** 18:
	print(-1)
else:
	print(p)


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


n = int(input())
a = sorted([int(i) for i in input().split()])
cnt = 1
for ai in a:
	cnt *= ai
	if cnt > 10 ** 18:
		print(-1)
		exit()
print(cnt)


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


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


n = int(input())
L = list(map(int, input().split()))
ans = 1
L.sort()
for l in L:
	ans *= l
	if ans > 10 ** 18:
		print('-1')
		quit()
print(ans)


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


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


n = int(input())
t = [int(i) for i in input().split()]
t.sort()
ans = 1
for i in t:
	ans *= i
	if ans > 10 ** 18:
		ans = -1
		break
print(ans)


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


n = int(input())
li = list(map(int, input().split()))
pr = 1
gr = 0
for l in li:
	pr = pr * l
	if pr > 1e+18:
		gr = 1
		break
if gr == 1:
	if 0 in li:
		print(0)
	else:
		print('-1')
else:
	print(pr)


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


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


N = int(input())
L = list(map(int, input().split()))
ans = 1
L.sort()
flag = False
for i in L:
	ans = ans * i
	if ans > 10 ** 18:
		ans = -1
		break
print(ans)


n = int(input())
A = input().split()
A.sort()
s = 1
for i in range(n):
	s *= int(A[i])
	if s > 10 ** 18:
		print(-1)
		exit()
print(s)


input()
x = 1
(*A,) = map(int, input().split())
if 0 in A:
	print(0)
	return
for a in A:
	x *= a
	if x > 10 ** 18:
		print(-1)
		return
print(x)


dontt_use = input()
str_list = list(input().split())
n = map(int, str_list)

def foo(n):
	total = 1
	for number in n:
		total = total * number
		if total > 10 ** 18:
			print('-1')
			return
	print(total)
if '0' in str_list:
	print(0)
else:
	foo(n)


n = int(input())
l = list(map(int, input().split()))
m = 1
l.sort()
for i in range(n):
	m *= l[i]
	if m > 10 ** 18:
		print(-1)
		return
print(m)


(n, *a) = map(int, open(0).read().split())
res = 1
if 0 in a:
	print(0)
	exit()
for a in a:
	res *= a
	if res > 1e+18:
		res = -1
		break
print(res)


n = int(input())
a = sorted(map(int, input().split()))
p = 1
for i in a:
	p *= i
	if p > 1e+18:
		p = -1
		break
print(p)


n = int(input())
a = list(map(int, input().split()))
a.sort()
m = pow(10, 18)
ans = 1
for ai in a:
	ans *= ai
	if ans > m:
		print(-1)
		exit()
print(ans)


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


input()
a = 1
for i in input().split():
	a *= int(i)
	a = [-1, a][0 <= a <= 10 ** 18]
print(a)


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


N = int(input())
a = 1
L = list(map(int, input().split()))
L.sort()
for i in L:
	a *= i
	if a > 1e+18:
		break
print(-1 if a > 1e+18 else a)


a = 1
d = 10 ** 18
for i in [*open(0)][1].split():
	a = min(a * int(i), d + 1)
print([a, -1][a > d])


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


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


(n, *a) = map(int, open(0).read().split())
s = 1
if 0 in a:
	print(0)
	exit()
for i in a:
	s *= i
	if s > 1e+18:
		print(-1)
		exit()
print(s)


(n, *a) = map(int, open(0).read().split())
MX = 10 ** 18
prod = 1
for q in sorted(a):
	prod *= q
	if prod > MX:
		print(-1)
		exit()
print(prod)


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


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


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


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


from typing import List

def answer(n: int, a: List[int]) -> int:
	if 0 in a:
		return 0
	max_value = 10 ** 18
	product = 1
	for i in a:
		product *= i
		if max_value < product:
			return -1
	return product

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

def __starting_point():
	main()
__starting_point()


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


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


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


import sys
n = int(input())
A = sorted(list(map(int, input().split())))
ans = 1
if A[0] == 0:
	print(0)
else:
	for i in range(len(A)):
		ans *= A[i]
		if ans > 10 ** 18:
			print(-1)
			return
	print(ans)


input()
a = 1
d = 1000000000000000000
for i in input().split():
	a *= [int(i), 1][(a > d) * (i != '0')]
print([a, -1][a > d])


N = int(input())
m = 1
for n in input().split():
	i = int(n)
	m = m * i
	if m > 10 ** 18 or m < 0:
		m = -1
print(m)


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


(n, *a) = map(int, open(0).read().split())
if 0 in a:
	print(0)
	exit()
x = 1
for y in a:
	x *= y
	if x > 10 ** 18:
		print(-1)
		exit()
print(x)


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)


n = int(input())
t = list(map(int, input().split()))
t.sort()
ans = 1
for i in t:
	ans *= i
	if 10 ** 18 < ans:
		print(-1)
		exit()
print(ans)


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


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


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


import math
import decimal

def i_input():
	return int(input())

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

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

def i_row(N):
	return [int(input()) for _ in range(N)]

def i_row_list(N):
	return [list(map(int, input().split())) for _ in range(N)]
n = i_input()
aa = i_list()
aa.sort()
ans = 1
for a in aa:
	ans *= a
	if ans > 10 ** 18:
		ans = -1
		break
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
otv = 1
for x in sorted(a):
	otv *= x
	if otv > 10 ** 18:
		print(-1)
		exit(0)
print(otv)


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


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


(_, a) = open(0)
t = 1
for b in sorted(a.split()):
	t *= int(b)
	if t > 10 ** 18:
		t = -1
		break
print(t)


N = int(input())
A = list(map(int, input().split()))
B = 0
C = 1
if 0 in A:
	print(0)
	return
for i in range(N):
	C = C * A[i]
	if C > 1000000000000000000:
		print(-1)
		return
print(C)


n = int(input())
ans = 1
for i in sorted(map(int, input().split())):
	ans *= i
	if ans > 1e+18:
		print(-1)
		exit()
print(ans)


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


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


input()
s = 1
for a in map(int, input().split()):
	if a == 0:
		s = 0
		break
	if s > 0:
		s *= a
	if s > 1e+18:
		s = -1
print(s)


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


import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
x = 1
for i in range(n):
	x *= a[i]
	if x > 10 ** 18:
		print(-1)
		sys.exit()
print(x)


from heapq import *
N = int(input())
As = list(map(int, input().split()))
heapify(As)
while len(As) >= 2:
	A1 = heappop(As)
	A2 = heappop(As)
	heappush(As, A1 * A2)
if As[0] > 10 ** 18:
	print(-1)
else:
	print(As[0])


input()
a = list(map(int, input().split()))
a.sort()
b = 1
for i in a:
	b *= i
	if b > 1e+18:
		print(-1)
		exit()
print(b)


n = int(input())
l = list(map(int, input().split()))
if 0 in l:
	print('0')
	return
result = l[0]
l.pop(0)
for data in l:
	result *= data
	if result > 10 ** 18:
		result = -1
		break
print(result)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
ans = 1
for val in arr:
	ans *= val
	if ans > 10 ** 18:
		print(-1)
		break
else:
	print(ans)


input()
l = input().split()
x = 1
for j in sorted(l):
	x *= int(j)
	if x > 1e+18:
		x = -1
		break
print(x)


N = int(input())
nums = [int(i) for i in input().split()]

def calc(N, nums):
	ans = 1
	flg = False
	if 0 in nums:
		return 0
	for i in range(N):
		ans *= nums[i]
		if ans > 10 ** 18:
			flg = True
			break
	if flg:
		return -1
	else:
		return ans
print(calc(N, nums))


N = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
prod = 1
for i in arr:
	prod *= i
	if prod > 10 ** 18:
		prod = -1
		break
print(prod)


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


num = int(input())
list = list(map(int, input().split()))
list.sort()
a = 1
for i in list:
	a = a * i
	if a > 10 ** 18:
		a = -1
		break
print(a)


input()
a = 1
d = 1000000000000000000
for i in input().split():
	a = min(a * int(i), d + 1)
print([a, -1][a > d])


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


N = int(input())
A = [*map(int, input().split())]
a = 1
if 0 in A:
	a = 0
else:
	while A:
		a *= A.pop()
		if a > 10 ** 18:
			a = -1
			break
print(a)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
prod = 1
for x in a:
	prod *= x
	if prod > 10 ** 18:
		prod = -1
		break
print(prod)


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

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


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


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] == 0:
		print(0)
		return
tmp = 1
for i in range(n):
	if a[i] <= int(1e+18) // tmp:
		tmp *= a[i]
	else:
		print(-1)
		return
print(tmp)


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


N = int(input())
CONST = 10 ** 18
result = 1
numbers = list(map(int, input().split()))
if 0 in numbers:
	print(0)
	return
numbers.sort(reverse=True)
for i in numbers:
	result = result * i
	if result > CONST:
		print(-1)
		return
print(result)


input()
l = list(map(int, input().split()))
l.sort()
r = 1
for i in l:
	r *= i
	if r > 10 ** 18:
		print('-1')
		exit(0)
print(r)


(N, *X) = map(int, open(0).read().split())
X.sort()
ans = 1
for v in X:
	ans *= v
	if ans > 10 ** 18:
		ans = -1
		break
print(ans)


i = input
i()
l = i().split()
x = not '0' in l
for j in l:
	x *= int(j)
	if x > 1e+18:
		x = -1
		break
print(x)


num = input()
a = input().split()
b = 1
if '0' in a:
	b = 0
else:
	for i in a:
		b *= int(i)
		if b > 10 ** 18:
			b = -1
			break
print(b)


(n, *a) = map(int, open(0).read().split())
a.sort()
if a[0] == 0:
	exit(print(0))
ans = 1
for q in a:
	ans *= q
	if ans > 10 ** 18:
		print(-1)
		exit()
print(ans)


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 = int(input())
A = sorted(list(map(int, input().split())))
ans = 1
for a in A:
	ans *= a
	if ans > 10 ** 18:
		ans = -1
		break
print(ans)


n = int(input())
a = map(int, input().split())
a = sorted(a)
s = 1
for x in a:
	s *= x
	if s > 1e+18:
		print(-1)
		exit()
print(s)


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)


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


input()
r = 1
for x in map(int, input().split()):
	if x == 0:
		r = 0
		break
	if r > 0:
		r *= x
		if r > 1e+18:
			r = -1
print(r)


input()
r = 1
for x in input().split():
	r = max(-1, r * int(x))
	if r > 1e+18:
		r = -1
print(r)


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


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


n = int(input())
a = map(int, input().split())
sum = 1
for x in a:
	sum *= x
	if sum > 1e+18:
		sum = -1
		break
if 0 in a:
	sum = 0
print(sum)


(a, b) = open(0)
c = 1
for i in sorted(b.split()):
	c *= int(i)
	if c > 10 ** 18:
		print(-1)
		exit()
print(c)


n = int(input())
a = sorted([int(x) for x in input().split()])
if a[0] == 0:
	print(0)
	return
ans = 1
for ai in a:
	ans *= ai
	if ans > 10 ** 18:
		print(-1)
		break
else:
	print(ans)


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


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


(n, *l) = map(int, open(0).read().split())
a = 1
for i in sorted(l):
	a *= i
	if a > 10 ** 18:
		a = -1
		break
print(a)


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


a = 1
d = eval('1' + '0' * 18)
for i in open(0).read().split()[1:]:
	a = min(a * int(i), d + 1)
print([a, -1][a > d])


import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
	print(0)
else:
	ans = 1
	for a_i in A:
		ans *= a_i
		if ans > 10 ** 18:
			print(-1)
			return
	print(ans)


N = int(input())
A = list(map(int, input().split()))
if 0 in A:
	print(0)
	return
else:
	flag = True
	prd = 1
	A.sort(reverse=True)
	for i in range(N):
		prd *= A[i]
		if prd > 10 ** 18:
			flag = False
			break
if flag:
	print(prd)
else:
	print(-1)


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


input()
a = [int(i) for i in 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)


a = int(input())
b = list(map(int, input().split()))
b.sort()
c = 1
yon = 10 ** 18
for i in b:
	c *= i
	if c > yon:
		print(-1)
		exit()
print(c)


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


n = int(input())
l = list(map(int, input().split()))
l.sort()
x = 10 ** 18
a = 1
for i in l:
	a = a * i
	if a > x:
		a = -1
		break
print(a)


x = int(input())
s = list(map(int, input().split()))
s.sort()
res = 1
for n in s:
	res *= n
	if res > 1e+18:
		res = -1
		print(-1)
		exit(0)
print(res)


n = int(input())
A = list(map(int, input().split()))
MAX = 10 ** 18
ans = 1
for a in A:
	if a == 0:
		print(0)
		return
for a in A:
	ans *= a
	if MAX < ans:
		print(-1)
		return
print(ans)


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


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


n = int(input())
a = [int(i) for i in input().split()]
b = 1
a.sort()
for i in a:
	b = b * i
	if b > 10 ** 18:
		b = -1
		break
print(b)


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


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)


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


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


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, bisect
import sys
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
nf = lambda : float(ns())
na = lambda : list(map(int, stdin.readline().split()))
nb = lambda : list(map(float, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
max_ = 10 ** 18
N = ni()
A = na()
A.sort()
ans = 1
for i in range(N):
	ans *= A[i]
	if ans > max_:
		ans = -1
		break
print(ans)


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


N = int(input())
A = map(int, input().split())
ans = 1
for x in A:
	ans *= x
	if ans > 10 ** 18:
		ans = 10 ** 18 + 1
print(-1 if ans > 10 ** 18 else ans)


N = int(input())
A = list(map(int, input().split()))
ans = 1
A.sort()
for i in range(N):
	ans *= A[i]
	if ans > 1e+18:
		print(-1)
		break
else:
	print(ans)


import random
import time
import copy
import io, sys
n = int(input())
a = list(map(int, input().split()))
sum = 1
for a_ in a:
	if sum != -1:
		sum *= a_
	if sum != 0 and sum > pow(10, 18):
		sum = -1
	if a_ == 0:
		sum = 0
		break
print(sum)


n = int(input())
a = list(map(int, input().split()))
s = 1000000000000000000
(k, c) = (1, 0)
for i in a:
	if k * i > s:
		c = 1
		break
	k *= i
if 0 in a:
	print(0)
elif c == 0:
	print(k)
else:
	print(-1)


N = int(input())
A = list(map(int, input().split()))
M = 1
A.sort()
if A[0] == 0:
	M = 0
else:
	for j in A:
		M = M * j
		if M > 10 ** 18:
			M = -1
			break
print(M)


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


N = int(input())
A = list(map(int, input().split()))
r = 1
if 0 in A:
	r = 0
for n in A:
	r = r * n
	if r > 10 ** 18:
		r = -1
		break
print(r)


(a, b) = open(0)
c = 1
for i in sorted(b.split()):
	c = [(d := (int(i) * c)), -1][10 ** 18 < d or c < 0]
print(c)


input()
a = sorted(map(int, input().split()))
z = 1
for i in a:
	z *= i
	if z > 1e+18:
		z = -1
		break
print(z)


N = int(input())
T = 1e+18
arr = [int(i) for i in input().split()]
A = 1
for a in arr:
	A *= a
	if A < 0:
		A = -1
	if A > T:
		A = -1
print(A)


input()
l = list(map(int, input().split()))
l.sort()
res = 1
for x in l:
	res *= x
	if res > 10 ** 18:
		print(-1)
		exit(0)
print(res)


n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 1
for i in range(n):
	res *= a[i]
	if res > 1e+18:
		print(-1)
		exit(0)
print(res)


N = int(input())
List = list(map(int, input().split()))
ans = 1
for item in List:
	ans *= item
	if ans > 10 ** 18 or ans <= -1:
		ans = -1
print(ans)


n = int(input())
v = input().split(' ')
prod = 1
v.sort()
for i in v:
	prod *= int(i)
	if int(prod) > int(1e+18):
		prod = -1
		break
print(prod)


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


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


(_, *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)


from sys import exit
n = int(input())
A = list(map(int, input().split()))
A.sort()
tmp = 1
for a in A:
	tmp *= a
	if tmp > 10 ** 18:
		print('-1')
		exit()
print(tmp)


n = int(input())
aaa = sorted(map(int, input().split()), reverse=True)
if aaa[-1] == 0:
	ans = 0
else:
	ans = 1
	limit = 10 ** 18
	for a in aaa:
		ans *= a
		if ans > limit:
			ans = -1
			break
print(ans)


input()
A = list(map(int, input().split()))
A = sorted(A)
p = 1
for i in A:
	p *= i
	if p > 10 ** 18:
		p = -1
		break
print(p)


num = int(input())
line = input().split(' ')
checklis = sorted(line)
if checklis[0] == '0':
	res = 0
else:
	res = 1
	i = 0
	while res <= 1000000000000000000 and i < num:
		res *= int(line[i])
		i += 1
	if res > 1000000000000000000:
		res = -1
print(res)


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


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


n = int(input())
aaa = sorted(map(int, input().split()))
ans = 1
limit = 10 ** 18
for a in aaa:
	ans *= a
	if ans > limit:
		ans = -1
		break
print(ans)


N = int(input())
L = list(map(int, input().split()))
L.sort()
M = 1
for i in L:
	M *= i
	if M > 10 ** 18:
		M = -1
		break
print(M)


input()
l = input().split()
x = not '0' in l
for j in l:
	x = x * int(j) if 0 <= x * int(j) <= 1e+18 else -1
print(x)