eval(input())

r = 1

for x in input().split():

  r = max(-1, r * int(x))

  if r > 1e18:

    r = -1

print(r)

eval(input())

r = 1

for x in map(int, input().split()):

  if x == 0:

    r = 0

    break

  if r > 0:

    r *= x

    if r > 1e18:

      r = -1

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

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

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