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

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0

if(can==1):
    print(ans)
else:
    print(-1)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0
            break

if(can==1):
    print(ans)
else:
    print(-1)

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

ans = 1
can = 1
zero = 0

for i in range(N):
    if a[i]==0:
        zero = 1
        ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0

if(can==1):
    print(ans)
else:
    print(-1)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0
            break

if(can==1):
    print(ans)
else:
    print(-1)

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

ans = 1
can = 1
zero = 0

for i in range(N):
    if a[i]==0:
        zero = 1
        ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0

if(can==1):
    print(ans)
else:
    print(-1)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0
            break

if(can==1):
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
a.sort()

ans = 1
can = 1
for i in range(N):
    ans = ans * a[i]
    if(ans>1000000000000000000):
        can = 0

if(can==1):
    print(ans)
else:
    print(-1)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0
            break

if(can==1):
    print(ans)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
a.sort()

ans = 1
can = 1
for i in range(N):
    ans = ans * a[i]
    if(ans>1000000000000000000):
        can = 0

if(can==1):
    print(ans)
else:
    print(-1)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))

ans = 1
can = 1
zero = 0

if 0 in a:
    zero = 1
    ans = 0

if(zero==0):
    for i in range(N):
        ans = ans * a[i]
        if(ans>1000000000000000000):
            can = 0
            break

if(can==1):
    print(ans)
else:
    print(-1)