n = int(eval(input()))

a = [int(_) for _ in input().split()]

a.sort()

ans = 1

for i in a:

    if i == 0:

        ans = 0

        break

    ans *= i

    if ans > 10**18:

        ans = -1

        break

 

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

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

nums.sort()

ans = 1

for i in nums:

    if i == 0:

        ans = 0

        break

    ans *= i

    if ans > 10 **18:

        ans = -1

        break

print(ans)

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

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

-n = int(eval(input())) -a = [int(_) for _ in input().split()] -a.sort() +num = int(eval(input())) +nums = list(map(int, input().split())) +nums.sort() -for i in a: +for i in nums: