Problem: Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.  However, if the result exceeds 10^{18}, print `-1` instead.

Submission attempts (in order):
N = input(int())
ans = 1
i = []

list = [i for i in input().split()]

for a in range(N-1):
  ans = ans * i[a]

  if ans > 10**18:
    ans = -1

print(ans)

N = input(int())
ans = 1

list = [i for i in input().split()]

for a in range(N-1):
  ans * i[a] = ans

  if ans > 10**18:
    ans = -1

print(ans)

N = input(int())
ans = 1
i = []
 
list = [i for i in input().split()]
 
for i in range(N-1):
  ans = ans * i
 
if ans > 10**18:
    ans = "-1"
 
print(str(ans))

N = input(int())
ans = 1
i = []
 
list = [i for i in input().split()]
 
for a in range(N-1):
  ans = ans * i[a]
 
if ans > 10**18:
    ans = "-1"
 
print(str(ans))

N = int(input())
ans = 1


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

if '0' in i:
    print(0)
    return

  for b in range(N):
    ans = ans * i[b]
 
    if ans > 10**18:
      ans = -1
 
print(ans)

N = input(int())
ans = 1
i = []
 
list = [i for i in input().split()]
 
for a in range(N):
  ans = ans * i[a]
 
  if ans > 10**18:
    ans = -1
 
print(str(ans))

N = int(input())
ans = 1
 
i = []
 
i = [int(a) for a in input().split()]

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

N = input(int())
ans = 1
i = []
a = int()
 
list = [i for i in input().split()]
 
for a in range(N-1):
  ans = ans * i[a]
 
if ans > 10**18:
    ans = "-1"
 
print(str(ans))

N = input(int())
ans = 1

list = [i for i in input().split()]

for a in range(N-1):
  ans = ans * i[a]

  if ans > 10**18:
    ans = -1

print(ans)

N = input(int())
ans = 1
i = []

list = [i for i in input().split()]

for a in range(N-1):
  ans = ans * i[a]

if ans > 10**18:
    ans = -1

print(ans)

N = input(int())
ans = 1

list = [i for i in input().split()]

for a in range(N-1):
  ans = ans * list[a]

  if ans > 10**18:
    ans = -1

print(ans)

N = input(int())
ans = 1
i = []
 
list = [i for i in input().split()]
 
for i in range(N - 1):
  ans = ans * i
 
  if ans > 10**18:
    ans = -1
 
print(str(ans))

N = input(int())
ans = 1
i = []
 
list = [i for i in input().split()]
 
for i in range(N - 1):
  ans = ans * i
 
  if ans > 10**18:
    ans = -1
 
print(str(ans))

N = int(input())
ans = 1
i = []
 
list = [i for i in input().split()]
 
  for a in range(N-1):
  ans = ans * i[a]
 
    if ans > 10**18:
    ans = -1
 
print(ans)

N = int(input())
ans = 1
i = []
 
list = [i for i in input().split()]

 
for a in range(N-1):
  ans = ans * i[a]
 
  if ans > 10**18:
    ans = -1
 
print(ans)

N = int(input())
ans = 1
 
i = [int(a) for a in input().split()]
 
if 0 in i:
  print(0)
 
for b in range(N):
  ans = ans * i[b]
 
  if ans > 10**18:
   	 ans = -1
     break
 
print(ans)

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

ans = 1

if 0 in a:
    print("0")
    exit()

for i in a:
    ans *= i

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted