Buggy python submission (verdict: Time Limit Exceeded):
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort()
if x[0]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
  if first_value > 1e18:
    print(-1)
  else:
    print(first_value)

Fixed submission:
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)

Buggy python submission (verdict: Time Limit Exceeded):
lenght = int(input())
 
x = list(map(int,input().split()))
first_value = 1
for val in x:
  first_value *= val
if first_value > 1e18:
  print(-1)
else:
  print(first_value)

Fixed submission:
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)

Buggy python submission (verdict: Time Limit Exceeded):
lenght = int(input())
 
x = list(map(int,input().split()))
first_value = 1
for i in range(lenght):
  first_value *= x[i]
  if first_value == 0:
    break
if first_value > 1e18:
  print(-1)
else:
  print(first_value)

Fixed submission:
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)

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

a= x[1:]
a2= x[:1]
for i in a:a2.append(a2[-1]*i)

if a2[-1] > 1e18:
	print(-1)
else:
  	print(a2[-1])

Fixed submission:
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)

Buggy python submission (verdict: Time Limit Exceeded):
lenght = int(input())
 
x = list(map(int,input().split()))
 
for i in range(lenght-1):
  x[i+1] = x[i] * x[i+1]
if x[-1] > 1e18:
  x[-1] = -1
print(x[-1])

Fixed submission:
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)

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

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

first_val = x[0]
for i in range(lenght-1):
  first_val *= x[i+1]

if first_val > 1e18:
  first_val = -1

print(first_val)

Fixed submission:
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)