n = int(eval(input()))

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

a.sort()

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()))

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()))
a.sort()
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()))
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)

+if a[0] == 0: +    print((0)) +    exit() +a.sort(reverse=True)