qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
a = list(map(int, input().split(' ')))
res = 1
for i in range(n):
    res = res * a[i]
    if res > 1000000000000000000:
        print(-1)
        exit()
print(res)

Fixed code:
n = int(input())
a = list(map(int, input().split(' ')))
res = 1
a = sorted(a)
for i in range(n):
    res = res * a[i]
    if(a[i] == 0):
      print(0)
      exit()
    if res > 1000000000000000000:
        print(-1)
        exit()
print(res)
Buggy code:
N = int(input())
A = list(map(int,input().split()))

x = 1
for i in range(len(A)):
	x = x * A[i]

if x >= 10 ** 18:
	print("-1")
else:
	print(x)

Fixed code:
N = int(input())
A = list(map(int,input().split()))

flag = 0
for i in range(len(A)):
	if A[i]==0:
		flag =1

if flag == 1 :
	print("0")
else:
	x = 1
	for i in range(len(A)):
		x = x * A[i]
		if x > 10 ** 18:
			break
          
    
	if x > 10 ** 18:
		print("-1")
	else:
		print(x)
Buggy code:
N = int(input())
A = list(map(int,input().split()))
count = 1
flag = True
for i in range(N):
    count = count * A[i]
    if count > 10 ** 18:
        print(-1)
        flag = False
        break
if flag:
    print(count)

Fixed code:
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
else:
    count = 1
    flag = True
    for i in range(N):
        count = count * A[i]
        if count > 10 ** 18:
            print(-1)
            flag = False
            break
    if flag:
        print(count)
Buggy code:
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans *= A_list[i]
    if ans > 10 ** 18:
        print(-1)
        break
else:
    print(ans)

Fixed code:
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))

if A_list.count(0) > 0:
    print(0)
else:
    ans = 1
    for i in range(N):
        ans *= A_list[i]
        if ans > 10 ** 18:
            print(-1)
            break
    else:
        print(ans)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
  print(-1)
  exit()
for i in range(len(a)):
  ans *= a[i]
  if ans > 10**18:
    print(-1)
    exit()
print(ans)

Fixed code:
n = int(input())
a = list(map(int, input().split()))
ans = 1
a.sort()
if a[0] == 0:
    print(0)
    exit()
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
Buggy code:
from functools import reduce
from operator import mul
import sys
input = sys.stdin.readline

count = int(input())
list = list(map(int, input().split()))
sum = list[0]
if 0 in list:
    print(0)
else:
    for i in range(count - 1):
        sum = sum * list[i + 1]
    if sum > 1000000000000000000:
        print(-1)
        exit()


print(sum)

Fixed code:
from functools import reduce
from operator import mul
import sys
input = sys.stdin.readline

count = int(input())
list = list(map(int, input().split()))
sum = list[0]
if 0 in list:
    print(0)
    exit()
else:
    for i in range(count - 1):
        sum = sum * list[i + 1]
        if sum > 1000000000000000000:
            print(-1)
            exit()


    print(sum)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

ans = 1
for a in A:
    ans = ans * a
    if (ans > 10 ** 18):
        print(-1)
        exit(0)


Fixed code:
N = int(input())
A = list(map(int, input().split()))

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

ans = 1
for a in A:
    ans = ans * a
    if (ans > 10 ** 18):
        print(-1)
        exit(0)

print(ans)
Buggy code:
# B - Multiplication 2
def main():
    _, *A = map(int, open(0).read().split())
    prod = 1
    LIM = 10 ** 18
    for i in A:
        prod *= i
        if prod > LIM:
            print(-1)
            return 
    print(prod)


if __name__ == "__main__":
    main()


Fixed code:
# B - Multiplication 2
def main():
    _, *A = map(int, open(0).read().split())
    if 0 in A:
        print(0)
        return 
    prod = 1
    LIM = 10 ** 18
    for i in A:
        prod *= i
        if prod > LIM:
            print(-1)
            return
    print(prod)


if __name__ == "__main__":
    main()
Buggy code:
N = int(input())
A = map(int,input().split())
counter = 1
for a in A:
    counter = counter*a
    if counter >10**18:
        print(-1)
        break
else:
    print(counter)

Fixed code:
N = int(input())
A = list(map(int,input().split()))
counter = 1

if 0 in A:
    print(0)
else:
    for a in A:
        counter = counter*a
        if counter >10**18:
            print(-1) 
            break
    else:
        print(counter)
Buggy code:
from sys import exit, stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)


Fixed code:
from sys import exit, stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 1
if 0 in A:
    print(0)
    exit()
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
Buggy code:
n = int(input())
a = [int(x) for x in input().split()]

maxval = 10 ** 18
ans = 1

for i in range(n):
    ans *= a[i]
    if ans > maxval:
        ans = -1
        break
print(ans)

Fixed code:
n = int(input())
a = [int(x) for x in input().split()]

maxval = 10 ** 18
ans = 1


for i in range(n):
    ans *= a[i]
    if ans > maxval:
        ans = -1
        break
    
if 0 in a:
    ans = 0
    
print(ans)
Buggy code:
n=int(input())
a = [int(i) for i in input().split() if i!="1"]

if 0 in a:
    print(0)

ans=1
for aa in a:
    ans=ans*aa

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

Fixed code:
n=int(input())
a = [int(i) for i in input().split() if i!="1"]

if 0 in a:
    print(0)
else:
    ans=1
    for aa in a:
        ans=ans*aa
        if ans>10**18:
            print(-1)
            break
    else:
        print(ans)
Buggy code:
from functools import reduce
from operator import mul

n = int(input())

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

ans = 1
for x in a:
    ans = ans * x
    if (ans > 1e18):
        ans = -1
        break

print(ans)


Fixed code:
from functools import reduce
from operator import mul

n = int(input())

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

a = sorted(a)
ans = 1
for x in a:
    ans = ans * x
    if (ans > 1e18):
        ans = -1
        break

print(ans)
Buggy code:
import sys
O = pow(10, 18)
N = int(input())
L = list(map(int, input().split()))
M = 1

for i in range(N):
    if L[i - 1] == 0:
        print(0)
        sys.exit()
    else:
        break

for i in range(N - 1):
    M = M * L[i]
    if O < M:
        print(-1)
        sys.exit()
    else:
        continue
print(M)

Fixed code:
import sys
O = pow(10, 18)
N = int(input())
L = list(map(int, input().split()))
M = 1

if 0 in L:
    print(0)
    sys.exit()

for i in range(N):
    M = M * L[i]
    if O < M:
        print(-1)
        sys.exit()
    else:
        continue
print(M)
Buggy code:
n = map(int,input().split())
a = list(map(int,input().split()))
LIM = 10**18

ans = 1

if 0 in a:
    print(0)
else:
    for i in a:
        ans *= i
if ans > LIM:
    print(-1)
else:
    print(ans)


Fixed code:
n = map(int,input().split())
a = list(map(int,input().split()))
LIM = 10**18

ans = 1

if 0 in a:
    print(0)
    exit()
else:
    for i in a:
        ans *= i
        if ans > LIM:
            print(-1)
            exit()

print(ans)
Buggy code:
N = int(input())
nums = list(map(int, input().split()))

cumul = 1
for i in range(N):
  	cumul *= nums[i]
    if cumul > 10**18:
    	print(-1)
        break

if cumul < 10**18: print(cumul)

Fixed code:
N = int(input())
nums = list(map(int, input().split()))

cumul = 1
if 0 in nums:
    print(0)
else:
    for i in range(N):
        cumul *= nums[i]
        if cumul > 10 ** 18:
            print(-1)
            break
    if cumul <= 10 ** 18: print(cumul)
Buggy code:
N = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(N):
    ans *= a[i]
    if ans > 10**18:
        ans = -1
        break
print(ans)

Fixed code:
N = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(N):
    if a[i] == 0:
        ans = 0
if ans != 0:
    for i in range(N):
        ans *= a[i]
        if ans > 10**18:
            ans = -1
            break

print(ans)
Buggy code:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    if ans>=10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)


Fixed code:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
A = list(ma())
ans = 1
for a in A:
    ans*=a
    #print(ans)
    if ans>10**18:
        ans = -1
        break
mi = min(A)
if mi>0:
    print(ans)
else:
    print(0)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
ans = 1

for i in range(N):
    if A[i] == 0:
        ans = 0
        break
    
    else:
        ans *= A[i]
        if ans > 10 ** 18:
            ans = -1
            break

print(ans)

Fixed code:
N = int(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)
Buggy code:
def main ():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A: 
        print (0)
        return
    prod = 1 
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
        print(-1) 
        return
    print(prod) 
main ()


Fixed code:
def main():
    N = int(input())
    A = list(map(int,input().split()))
    if 0 in A: 
        print (0)
        return
    prod = 1 
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1) 
            return
    print(prod) 

main()
Buggy code:
n = int(input())
nums = list(map(int, input().split()))
ans = 1

for i in range(n):
  ans *= nums[i]
  if ans > (10**18):
    ans = -1
    break

print(ans)


Fixed code:
n = int(input())
nums = list(map(int, input().split()))
ans = 1

if nums.count(0) > 0:
  ans = 0
else:
  for i in range(n):
    ans *= nums[i]
    if ans > 10**18:
      ans = -1
      break

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

Fixed code:
n = int(input())
a = 1
s = list(map(int, input().split()))
if 0 in s:
    print(0)
    exit()
for i in s:
    a*=i
    if a>10**18:
        print(-1)
        exit()
else:
    print(a)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

product = 1
for i in a:
    if i==0:
        product = 0
        break
    product *= i
    if product >= 10**18:
        product = -1
        break

print(product)


Fixed code:
n = int(input())
a = list(map(int, input().split()))

product = 1

if 0 in a:
    product = 0
else:
    for i in a:
        product *= i
        if product > 10**18:
            product = -1
            break

print(product)
Buggy code:
N = int(input())
a = list(map(int, input().split()))
max = 10**18
sum = 1
a.sort(reverse=True)
for i in a:
  sum *= i
  if sum > max:
    sum = -1
    break
print(sum)

Fixed code:
N = int(input())
a = list(map(int, input().split()))
max = 10**18
sum = 1
a.sort(reverse=True)
for i in a:
  sum *= i 
  if sum > max:
    sum = -1
    break
if 0 in a:
  sum = 0
print(sum)
Buggy code:
n = int(input())
A = list(map(int,input().split()))
a=A[0]
for i in range(1,n):
    a = a*A[i]
    if(a>10**18):
        a=-1
        break
print(a)

Fixed code:
n = int(input())
A = list(map(int,input().split()))
if(0 in A):
    print(0)
else:
    a=A[0]
    for i in range(1,n):
        a = a*A[i]
        if(a>10**18):
            a=-1
            break
    print(a)
Buggy code:
def Judge(x,y):
    sum=1
    for i in range(y):
        sum*=x[i]
        #print(sum)
        if sum>10**18:
            return -1
    return sum

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

c=Judge(a,n)
print(c)

Fixed code:
def Judge(x,y):
    sum=1
    for i in range(y):
        if x[i]==0:
            return 0
    for i in range(y):
        sum*=x[i]
        #print(sum)
        if sum>10**18:
            return -1
    return sum

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

c=Judge(a,n)
print(c)
Buggy code:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
for i in a:
    ans = ans * i
    if ans == 0:
        print(0)
        break
    elif ans >= 10**18:
        if 0 in a[i:-1]:
            print(0)
            break
        else:
            print(-1)
            break
if ans != 0 and ans <= 10**18:
    print(ans)

Fixed code:
n = int(input())
a = [int(x) for x in input().split()]
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans = ans * i
        if ans > 10**18:
            print(-1)
            break
    if ans <= 10**18:
        print(ans)
Buggy code:
n = int(input())
an = list(map(int, input().split()))

ans = 1
for i in an:
    ans *= i
    if(ans > 10 ** 18):
        print(-1)
        break
else:
    print(ans)

Fixed code:
n = int(input())
an = list(map(int, input().split()))

ans = 1

if(0 in an):
    print(0)
    
else:
    for i in an:
        
        ans *= i
        if(ans > 10 ** 18):
            print(-1)
            break
        
    else:
        print(ans)
Buggy code:
n = int(input())
m = 1000000000000000000
num_list = [ int(v) for v in input().split() ]
ans = 1
s = 0
for i in num_list:
	ans *= i
	if ans > m:
		s = 1
		break
if s == 0:
	print(ans)
else:
  	print(-1)

Fixed code:
n = int(input())
m = 1000000000000000000
num_list = [ int(v) for v in input().split() ]
ans = 1
s = 0
if 0 in num_list:
	ans = 0
for i in num_list:
	ans *= i
	if ans > m:
		s = 1
		break
if s == 0:
	print(ans)
else:
  	print(-1)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
answer=1
for i in range(n):
    answer*=a[i]
    if answer>10**18:
        answer=-1
        break
print(answer)

Fixed code:
n=int(input())
a=list(map(int,input().split()))
res=1
for i in range(n):
    res*=a[i]
    if res>10**18:
        res=-1
        break
for i in range(n):
    if a[i]==0:
        res=0
print(res)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1

for i in range(N):
    num = A[i]
    ans *= num
    if ans <= 0:
        break
    elif ans >= 10**18:
        ans = -1

print(ans)

Fixed code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
check = 10 ** 18

for i in range(N):
    num = A[i]
    ans *= num
    if ans > check:
        ans = -1
        break
    elif ans == 0:
        break

print(ans)
Buggy code:
n = int(input())
ans = 1
c=list(map(int, input().split()))
  
for i in range(n):
  ans *= c[i]
  if ans>10**18:
    print(-1)
    break
    
if ans<=10**18:
  print(ans)

Fixed code:
n = int(input())
ans = 1
c=list(map(int, input().split()))

if 0 in c:
  print(0)
  
else:
  for i in range(n):
    ans *= c[i]
    if ans>10**18:
      print(-1)
      break
    
  if ans<=10**18:
    print(ans)
Buggy code:
n=int(input())
a=list(map(int, input().split()))
ans=False
f=True
for i in a:
    ans*=i
    if ans>10**18:
        f=True
        break
if f:
    print(-1)
else:
    print(ans)

Fixed code:
n=int(input())
a=sorted(list(map(int, input().split())))
ans=1
f=True
for i in a:
    ans*=i
    if ans>10**18:
        f=False
        break
if f:
    print(ans)
else:
    print(-1)
Buggy code:
import sys
N=int(input())

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

ans=1
for a in a_list:
    ans*=a
    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)

print(ans)

Fixed code:
import sys
N=int(input())

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

ans=1

if 0 in a_list:
    print(0)
    sys.exit(0)

for a in a_list:
    ans*=a

    if ans > 1000000000000000000:
        print(-1)
        sys.exit(0)

print(ans)
Buggy code:
def default():
    maxi=1000000000000000000
    n=int(input())
    answer=1
    temp=input()
    temp=temp.split()
    flag=0
    for i in range(0,n):
        temp[i]=int(temp[i])
        answer*=temp[i]
        if(answer>maxi):
            flag=1
            break
        if(temp[i]==0):
            flag==2
            break
    if(flag==1):
        print(-1)
    else:
        if(flag==2):
            print(0)
        else:
            print(answer)

if(__name__=="__main__"):
    default()


Fixed code:
def default():
    maxi=1000000000000000000
    n=int(input())
    answer=1
    temp=input()
    temp=temp.split()
    flag=0
    for i in range(0,n):
        temp[i]=int(temp[i])
    temp.sort()
    for i in range(0,n):
        answer*=temp[i]
        if(answer>maxi):
            flag=1
            break
        if(temp[i]==0):
            flag==2
            break
    if(flag==1):
        print(-1)
    else:
        if(flag==2):
            print(0)
        else:
            print(answer)

if(__name__=="__main__"):
    default()
Buggy code:
import sys

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

if 0 in l:
	print(21)
	sys.exit()

flg=False
a = 1
for i in l:
	a *= i
	if a>10e17:
		flg=True
		break
 
if flg:
	print(-1)
else:
	print(a)

Fixed code:
import sys

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

if 0 in l:
	print(0)
	sys.exit()

flg=False
a = 1
for i in l:
	a *= i
	if a>10e17:
		flg=True
		break
 
if flg:
	print(-1)
else:
	print(a)
Buggy code:
n=int(input())
L=list(map(int,input().split()))
flag=0
ans=1
for i in range(n):
    ans*=L[i]
    if ans>int(1e18):
        print(-1)
        flag=1
        break
if flag==0:
    print(ans)



Fixed code:
n=int(input())
L=list(map(int,input().split()))
L.sort()
if L[0]==0:
    print(0)
else:
    ans=1
    for i in range(n-1,-1,-1):
        ans=ans*L[i]
        if ans >1e18:
            print(-1)
            break
    else:
        print(ans)
Buggy code:
N = input()
A = list(map(int, input().split()))

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

Ans = 1
for i in range(0,len(A)):
    Ans *= A[i]
    if Ans > 10**9:
        print(-1)
        exit()
    else:
        continue
print(Ans)

Fixed code:
N = input()
A = list(map(int, input().split()))

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

Ans = 1
for i in range(0,len(A)):
    Ans *= A[i]
    if Ans > 10**18:
        print(-1)
        exit()
    else:
        continue
print(Ans)
Buggy code:
n,*a=map(int,open(0).read().split())
ans=1
for ai in a:
  ans*=ai
  if ans>10**18:
    print(-1)
    exit()
print(ans)

Fixed code:
n,*a=map(int,open(0).read().split())
a.sort()
ans=1
for ai in a:
  ans*=ai
  if ans>10**18:
    print(-1)
    exit()
print(ans)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit()
a = sorted(a, reverse=True)
res = a[0]
for ai in a[1:]:
    res *= ai
    if res > 10**18:
        print(-1)
        exit()

Fixed code:
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit()
a = sorted(a, reverse=True)
res = a[0]
for ai in a[1:]:
    res *= ai
    if res > 10**18:
        print(-1)
        exit()
print(res)
Buggy code:
n = int(input())
al = list(map(int,input().split()))
al_p = 1

for i in range(n):
    al_p *= al[i]
    if al_p > 10*18:
        print(-1)
        return
        
print(al_p)

Fixed code:

def main():
    n = int(input())
    al = list(map(int,input().split()))
    al_p = 1

    if 0 in al:
        print(0)
        return

    for i in range(n):
        al_p *= al[i]
        if al_p > 10**18:
            print(-1)
            return
        
    print(al_p)

main()
Buggy code:
n=input()
nums=list(map(int,input().split()))

ans = 1
over = 10**18

for num in nums:
    if ans > over:
        print(-1)
    ans = ans * num

print(ans)


Fixed code:
n=input()
nums=list(map(int,input().split()))

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


ans = 1
over = 10**18

for num in nums:
    ans = ans * num

    if ans > over:
        print(-1)
        exit()

print(ans)
Buggy code:
N = int(input())
A = list(map(int, input().split()))

A.sort()
num = A[0]
for a in A[1:]:
  num *= a
  if num > 10 ** 18:
    print(-1)
    exit()
print(result)

Fixed code:
N = int(input())
A = list(map(int, input().split()))
 
A.sort()
num = A[0]
for a in A[1:]:
  num *= a
  if num > 10 ** 18:
    print(-1)
    exit()
print(num)
Buggy code:
n,*a=map(int,open(0).read().split())
a.sort()
for i in a:
    s *= i
    if s > 1e18:
        print(-1)
        exit()
print(s)

Fixed code:
n,*a=map(int,open(0).read().split())
s=1
if 0 in a:
    print(0)
    exit()
for i in a:
    s*=i
    if  s > 1e18:
        print(-1)
        exit()
print(s)
Buggy code:
import sys

n = int(input())
an = [int(num) for num in input().split()]

if 0 in an :
  print(0)
  sys.exit()

answer = an[0]
check = 10**18
for i in range(1,len(an)) :
  answer *= an[i]
  if answer >= check:
    print(-1)
    sys.exit()

print(answer)


Fixed code:
import sys

n = int(input())
an = [int(num) for num in input().split()]

if 0 in an :
  print(0)
  sys.exit()

answer = 1
check = 10**18
for i in range(len(an)) :
  answer *= an[i]
  if answer > check:
    print(-1)
    sys.exit()

print(answer)
Buggy code:
N = int(input())
A = [int(x) for x in input().split()]

p = 1
limit = 10 ** 18
for a in A:
    p *= a
    if p > limit:
        print(-1)
        exit()
print(p)


Fixed code:
N = int(input())
A = [int(x) for x in input().split()]
A = sorted(A)

p = 1
limit = 10 ** 18
for a in A:
    if a == 0:
        print(0)
        exit()
    p *= a
    if p > limit:
        print(-1)
        exit()
print(p)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
ans=1
for i in range(n):
    ans*=a[i]
    if ans<=10**18:
        continue
    else:
        ans=-1
        break
print(ans)

Fixed code:
n=int(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)
Buggy code:
x = input()
y = [int(a) for a in input().split(" ")]

res = 1
for i in y:
  res *= i
  if res > int(1e+18):
    print(-1)
    exit(0)
print(res)

Fixed code:
x = input()
y = [int(a) for a in input().split(" ")]
if 0 in y:
  print(0)
  exit(0)
res = 1
for i in y:
  res *= i
  if res > int(1e+18):
    print(-1)
    exit(0)
print(res)
Buggy code:
N = int(input())
a = list(map(int, input().split()))
a.sort()
INF = 10 ** 18
s = 1

print(a)
for i in a:
    s *= i
    if s > INF:
        s = -1
        break

print(s)


Fixed code:
N = int(input())
a = list(map(int, input().split()))
a.sort()
INF = 10 ** 18
s = 1

for i in a:
    s *= i
    if s > INF:
        s = -1
        break

print(s)
Buggy code:
n=input()
x=[int(i) for i in input().split()]
prod=1
for i in x:
  prod=prod*i
  if prod>1000000000000000000:
    break
if prod>1000000000000000000:
  print(-1)
else:
  print(prod)

Fixed code:
n=input()
x=[int(i) for i in input().split()]
x.sort()
prod=1
for i in x:
  prod=prod*i
  if prod>1000000000000000000:
    break
if prod>1000000000000000000:
  print(-1)
else:
  print(prod)
Buggy code:
b = 10**18
N = int(input())
A = list(map(int,input().split()))
ans = 1
for i in range(N):
  ans *= A[i]
  if ans > b:
    ans = -1
    break
print(ans)

Fixed code:
b = 10**18
N = int(input())
A = list(map(int,input().split()))
if 0 in A:
	print(0)
	exit()
ans = 1
for i in range(N):
  ans *= A[i]
  if ans > b:
    ans = -1
    break
print(ans)
Buggy code:
n = int(input())
a = list(map(int,input().split()))
def __main__():
    ans = 1
    for i in a:
        ans *= i
        if(ans > 10**18):
            print(-1)
            return
    print(ans)
    return

if(__name__=="__main__"):
    __main__()

Fixed code:
n = int(input())
a = list((map(int,input().split())))

def __main__():
    ans = 1
    if(0 in a):
        print(0)
        return
    else:
        for i in a:
            ans *= i
            if(ans > 10**18):
                print(-1)
                return
        print(ans)
        return

if(__name__=="__main__"):
    __main__()