n = int(eval(input()))

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

a.sort()



if a[0] == 0:

  print((0))

  exit()



a.sort(reverse=True)

ans = 1



for i in range(n):

  ans *= a[i]

  if ans > 10 ** 18:

    ans = -1

    break



print(ans)
N = int(eval(input()))

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

if 0 in A:

	print((0))

	exit()

prod = 1

for a in A:

	prod *= a

	if prod > 1000000000000000000:

		print((-1))

		exit()

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

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

-n = int(eval(input())) -a = list(map(int, input().split())) -a.sort() -if a[0] == 0: +N = int(eval(input())) +A = list(map(int, input().split())) +if 0 in A: -a.sort(reverse=True) -ans = 1 -for i in range(n): -    ans *= a[i] -    if ans > 10**18: -        ans = -1 -        break -print(ans) +prod = 1 +for a in A: +    prod *= a +    if prod > 1000000000000000000: +        print((-1)) +        exit() +print(prod)