Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul
import sys

input = sys.stdin.readline

n = int(input())
An = [int(x) for x in input(). split()]

for i in range(n):
    if An[i] == 0:
        print(0)
        quit()

j = 1000000000000000000
ans = 1
ans = reduce(mul, An)


if ans > j :
    print(-1)
    
else :
    print(ans)



Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul
import sys

input = sys.stdin.readline

n = int(input())
An = [int(x) for x in input(). split()]

j = 1000000000000000000
ans = 1
ans = reduce(mul, An)


if ans > j :
    print(-1)
    
else :
    print(ans)



Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul
import sys

input = sys.stdin.readline

n = int(input())
An = list(map(int, input().split()))

j = 1000000000000000000
ans = 1
ans = reduce(mul, An)


if ans > j :
    print(-1)
    
else :
    print(ans)



Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul

n = int(input())
An = list(map(int, input().split()))

j = 1000000000000000000

ans = 1

ans = reduce(mul, An)


if ans <= j :
    print(ans)
    
else :
    print('-1')



Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator


n = int(input())
An = list(map(int, input().split()))

j = 1000000000000000000

ans = 1

'''
for i in range(n) :
    ans *= An[i]
'''
result = functools.reduce(operator.mul, An)

if result <= j:
    print(result)
    
else :
    print('-1')



Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
An = list(map(int, input().split()))

j = 1000000000000000000

ans = 1

for i in range(n):
    ans *=  An[i]


if ans <= j:
    print(ans)
    
else :
    print('-1')



Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
An = list(map(int, input().split()))

j = 1000000000000000000

ans = 1

for i in range(n):
    ans = ans * An[i]

if ans <= j:
    print(ans)
    quit()
else :
    print('-1')
    quit()


Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())

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

j = 100000000000000000

ans = 1

for i in range(n):
    ans *= An[i]

if ans <= s:
    print(ans)
else :
    print('-1')


Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

ans = 1

for i in range(n):
    ans *= An[i]

if ans <= 10 ** 18:
    print(ans)
else :
    print('-1')


Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

ans = 1

for i in range(n):
    ans *= An[i]

if ans <= 10 ** 18:
    print(ans)
else :
    print(-1)


Fixed submission:

n = int(input())
An = [int(x) for x in input().split()]
An.sort(reverse=True)

if 0 in An:
    print(0)
    exit()

j = 10 ** 18
ans = 1
for i in range(n):
    if ans > j:
        print(-1)
        quit()
    ans *= An[i]

if ans > j :
    print(-1)
    
else :
    print(ans)