N = int(eval(input()))

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

A.sort()



prod = 1

for i in range(N):

  prod *= A[i]

  if prod > 10**18:

    prod = -1

    break

  elif prod == 0: break

  

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

N = int(eval(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)

-A = list(map(int, input().split())) -A.sort() -prod = 1 +(*A,) = list(map(int, input().split())) +if min(A) == 0: +    print((0)) +    exit() +ans = 1 -    prod *= A[i] -    if prod > 10**18: -        prod = -1 -        break -    elif prod == 0: -        break -print(prod) +    ans *= A[i] +    if ans > 10**18: +        print((-1)) +        exit() +print(ans)