_,a=open(0)

t=1

for b in sorted(a.split()):

 t*=int(b)

 if t>10**18:t=-1;break

print(t)
_,a=open(0)

t=1

for b in sorted(a.split()):

 t*=int(b)

 if t>1e18:t=-1;break

print(t)
_, a = open(0)
t = 1
for b in sorted(a.split()):
    t *= int(b)
    if t > 10**18:
        t = -1
        break
print(t)

_, a = open(0)
t = 1
for b in sorted(a.split()):
    t *= int(b)
    if t > 1e18:
        t = -1
        break
print(t)

-    if t > 10**18: +    if t > 1e18: