n=int(eval(input()))

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

if 0 in a:

    ans=0

else:

    ans=1

    for i in range(n):

        ans*=a[i]

        if ans<=10**18:

            continue

        else:

            ans=-1

            break

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

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

ans=1

if 0 in a:

  ans=0

else:

  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()))
if 0 in a:
    ans = 0
else:
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans <= 10**18:
            continue
        else:
            ans = -1
            break
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 1
if 0 in a:
    ans = 0
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            ans = -1
            break
print(ans)

+ans = 1 -    ans = 1 -        if ans <= 10**18: -            continue -        else: +        if ans > 10**18: