n = int(eval(input()))

MX = 10**18

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

a.sort()

ans = 1

for x in a:

  ans *= x

  if ans > MX:

    print((-1))

    exit(0)

print(ans)

n = int(eval(input()))

MX = 10**18

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

for x in a:

  if x == 0:

    print((0))

    exit(0)

ans = 1

for x in a:

  ans *= x

  if ans > MX:

    print((-1))

    exit(0)

print(ans)

n = int(eval(input()))
MX = 10**18
a = list(map(int, input().split()))
a.sort()
ans = 1
for x in a:
    ans *= x
    if ans > MX:
        print((-1))
        exit(0)
print(ans)

n = int(eval(input()))
MX = 10**18
a = list(map(int, input().split()))
for x in a:
    if x == 0:
        print((0))
        exit(0)
ans = 1
for x in a:
    ans *= x
    if ans > MX:
        print((-1))
        exit(0)
print(ans)

-a.sort() +for x in a: +    if x == 0: +        print((0)) +        exit(0)