Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    acc = functools.reduce(lambda x,y:x*y, a)
    if 10**18 < acc:
        acc = -1

    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    acc = functools.reduce(lambda x,y:x*y, a)
    if 10**18 < acc:
        acc = -1
    print(acc)
    #print(multiplication2(n,a))


Fixed submission:
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    #acc = functools.reduce(lambda x,y:x*y, a)
    acc = 1
    a_sorted = sorted(a)
    if a_sorted[0] == 0:
        return 0
    
    for s in a_sorted:

        acc = acc*s
        if 10**18 < acc:
            acc = -1
            break
    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    print(multiplication2(n,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    acc = functools.reduce(lambda x,y:x*y, a)
    if 10**18 < acc:
        acc = -1

    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    acc = functools.reduce(lambda x,y:x*y, a)
    if 10**18 < acc:
        acc = -1
    print(acc)
    #print(multiplication2(n,a))


Fixed submission:
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    #acc = functools.reduce(lambda x,y:x*y, a)
    acc = 1
    a_sorted = sorted(a)
    if a_sorted[0] == 0:
        return 0
    
    for s in a_sorted:

        acc = acc*s
        if 10**18 < acc:
            acc = -1
            break
    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    print(multiplication2(n,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    acc = functools.reduce(lambda x,y:x*y, a)
    if 10**18 < acc:
        acc = -1

    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    print(multiplication2(n,a))


Fixed submission:
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    #acc = functools.reduce(lambda x,y:x*y, a)
    acc = 1
    a_sorted = sorted(a)
    if a_sorted[0] == 0:
        return 0
    
    for s in a_sorted:

        acc = acc*s
        if 10**18 < acc:
            acc = -1
            break
    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    print(multiplication2(n,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def multiplication2(n,a):
    acc = 1
    for x in a:
        acc = x*acc
    if 10**18 < acc:
        acc = -1

    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    print(multiplication2(n,a))


Fixed submission:
import sys
input = sys.stdin.readline
import functools

def multiplication2(n,a):
    #acc = functools.reduce(lambda x,y:x*y, a)
    acc = 1
    a_sorted = sorted(a)
    if a_sorted[0] == 0:
        return 0
    
    for s in a_sorted:

        acc = acc*s
        if 10**18 < acc:
            acc = -1
            break
    return acc

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    print(multiplication2(n,a))