Problem:


Score : 200 points

Problem Statement

Given N integers A_1, ..., A_N, compute A_1 \times ... \times A_N.

However, if the result exceeds 10^{18}, print -1 instead.

Constraints

2 \leq N \leq 10^5

0 \leq A_i \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

Print the value A_1 \times ... \times A_N as an integer, or -1 if the value exceeds 10^{18}.

Sample Input 1

2
1000000000 1000000000

Sample Output 1

1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Sample Input 2

3
101 9901 999999000001

Sample Output 2

-1

We have 101 \times 9901 \times 999999000001 = 1000000000000000001, which exceeds 10^{18}, so we should print -1 instead.

Sample Input 3

31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0

Sample Output 3

0



Sample input:
2
1000000000 1000000000


Sample output:
1000000000000000000

Submission status: Runtime Error

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

d=1

for b in a:
  
  d=d*b
if d==10**18:
  print("-1")
  continue
  print(d)

Submission status: Runtime Error

Solution 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 ()

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(map(int,input().split()))
ans = 1

if 0 in s:
    print(0)
else:    
    for i in range(n+1):
        ans *= s[i]
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
s = map(int,input().split())
ans = 1

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

Submission status: Runtime Error

Solution code:
n = input()
s = []
ans = 1

for _ in range(n):
    s.append(map(int,input()))

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

Submission status: Runtime Error

Solution code:
n = input()
s = []
ans = 1

for _ in range(n):
    s.append(map(int,input()))

if 0 in s:
    print(0)
else:    
    for i in range(n+1):
        ans *= s[i]

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

Submission status: Runtime Error

Solution code:
n = input()
s = []
ans = 1

for _ in range(n):
    s.append(map(int,input()))

if "o" in s:
    print(0)
else:
    for i in range(n+1):
       ans *= s[i]
       if ans > 10**18:
           ans = -1
           break
    print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
m=list(map(int,input().split()))
x=1
if 0 in m:
  print(0)
else:
  for y in m:
    x*=y
    if x>10**18:
      print(-1)
      break
	else:
      print(x)

Submission status: Runtime Error

Solution code:
#B
unti()

def unti():
    N = int(input())
    A = list(map(int, input().split()))
    result = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        if 0 in A:
            print(0)
            break
        result *= a
    if result >10**18:
        print(-1)
    else:
        print(result)

Submission status: Runtime Error

Solution code:
a = input()
ys = map((lambda x: int(x)), xs)
for y in ys:
  print(y, type(y))

Submission status: Runtime Error

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

def f(x):
  x.sort()
  if x[0]==0:
    return 0

  x.sort(reversed=True)
  
  ans=1
  
  for i in a:
    ans=ans*i

    if ans>10**18:
      return -1
      
    if n==0:
      return ans
  


print(f(a))

Submission status: Runtime Error

Solution code:
x=1
n=int(input())
a=map(int,input().split())
m=list(a)
for x in m:
  if x==0:
    print(0)
  else:
    x*=x
if x<=10**18 and x!=0:
  print(x)
elif x==0:
  break
else:
  print(-1)

Submission status: Runtime Error

Solution code:
N = int(input())
l = [int(x) for x in input().split()]

if 0 in l:
    ans = 0
else:
    n = min(N,len(l))
    ans = 1
    for i in l[:n]:
        ans *= i
        if ans > 10**18:
            ans = -1
            bre
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
x=1000000000000000000
res=1
for i in range(n):
  x=int(input())
  res=res*x
if(res>x):
  print("-1")
else:
  print(res)

Submission status: Runtime Error

Solution code:
n=int(input())
x=1000000000000000000
res=1
for i in range(n):
	res=res*int(input())
if(res>x):
	print("-1")
else:
	print(res)

Submission status: Runtime Error

Solution code:
n=int(input())
x=1000000000000000000
res=1
for i in range(n):
  res=res*int(input())
if(res>x):
  print("-1")
else:
  print(res)

Submission status: Runtime Error

Solution code:
runT = 0
N=input()
LOI = input().split()
runT= int(LOI[0]) * int(LOI[1])
del LOI[0]
del LOI[1]
for i in range(0,N-3):
    runT= runT * int(LOI[0])
    del LOI[0]
if runT <= 10**18:
    print(runT)
elif runT > 10**18:
    print(-1)

Submission status: Runtime Error

Solution code:
runT = 0
N=input()
LOI = input().split()
runT= LOI[0] * LOI[1]
del LOI[0]
del LOI[1]
for i in range(0,N-3):
    runT= runT * LOI[0]
    del LOI[0]
if runT <= 10**18:
    print(runT)
elif runT > 10**18:
    print(-1)

Submission status: Runtime Error

Solution code:
runT = 0
N=input()
LOI = input().split(',')
runT= LOI[0] * LOI[1]
del LOI[0]
del LOI[1]
for i in range(0,N-3):
    runT= runT * LOI[0]
    del LOI[0]
if runT <= 10**18:
    print(runT)
elif runT > 10**18:
    print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list( map(int(input()).spilt() ))
if 0 in A:
       print(0)
       return
prod =1 
for a in A:
 prod *=a
  if prod > 1000000000000000000:
    prod=-1
    return
  
print(prod)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a_lst = list(map(int,input().split()))

ans = np.prod(a_lst)
if ans > 10**18:
    print("-1")
else:
    print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(ai) for ai in input().split()]
ans = 1
if 0 in A:
  print(0)
else:
  for ai in A:
    ans *= ai
  if ans > 10**18:
    print(-1)
    break
  else:
    print(ans)

Submission status: Runtime Error

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

def main(l, n):
    x = 1
    for i in range(0, n):
        x *= l[i]
    if x <=  10^18:
        print(x)
        break
    else:
        print(-1)

main(A, N)

Submission status: Runtime Error

Solution code:
N = int(input())
 
list=[int(i) for i in input().split()]
 
answer=1
if 0 in list:
  print(0)
else:
  for i in range(N):
    answer = answer*A[i]
    if answer>10**18:
      print(-1)
      break
  else:
    print(answer)

Submission status: Runtime Error

Solution code:
n = int(input())
result = 1
list=[]
list = list(map(int,input().split()))
if 0 in list:
  print(0)
else:
  for i in list:
  result *= list[i]
  if result > 10 ** 18:
  print(-1)
  break

print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
result = 1
list = []
list = list(map(int,input().split()))

for i in list:
  result *= i

if result > 10 ^ 18:
  print(-1)
else:
  print(result)

Submission status: Runtime Error

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

def main(l, n):
    x = 1
    for i in range(0, n):
        x *= l[i]
        if x <=  10^18:
            print(x)
        else:
            print(-1)

main(A)

Submission status: Runtime Error

Solution code:
import numpy as np
from numpy import ndarray
N = int(input())
A = np.array(map(int,input().split()))

def main(l, n):
    x = 1
    for i in range(0, n):
        x *= l[i]
        if x <=  10^18:
            print(x)
        else:
            print(-1)

main(A)

Submission status: Runtime Error

Solution code:
n = int(input())
result = 1
for i in range(n):
  result *= int(input())

if result > 10 ^ 18:
  print(-1)
else:
  print(result)

Submission status: Runtime Error

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

def main(l):
    x = np.prod(ｌ)
    if x <=  10^18:
        return x
    else:
        return -1

main(A)

Submission status: Runtime Error

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

if 0 in A:
  print(0)
  return

prod = 1
for x in A:
  prod *= x
  if prod > 1000000000000000000:
    print(-1)
    return

print(prod)

Submission status: Runtime Error

Solution 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 ()

Submission status: Runtime Error

Solution code:
input()
lst = list(map(int, input().split()))
counter = 0
print(counter for a in lst counter += a)

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
result = 1
for idx in N:
  result *= A[idx]
  
if result >= 10**18:
  print("-1")
print(result)

Submission status: Runtime Error

Solution code:
import sys
N = input()
a = list(map(int, input().split()))

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

b=1
for i in range(0,N):
    b *= a[i]
    if b > 1000000000000000000:
        print(-1)
        sys.exit

print(b)

Submission status: Runtime Error

Solution code:
n = int(input())
t = list(map(int, input().split()))
to = t[0]
if 0 in t:
  print(0)
  exit()
for a in t[1:]:
	to *= a
    if to > 10**18:
	print("-1")
    exit()
else:
  print(to)

Submission status: Runtime Error

Solution code:
n=int(input())
ls=list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans=1
	for a in ls:
		ans*=a
		if ans>0000000000000000000);
			ans=-1;
			break;
	print(ans)

Submission status: Runtime Error

Solution code:
n=int(input());
ls = list(map(int,input().split()))
if 0 in ls:
  print(0)
else:
    ans=1
    for a in ls:
    ans*=a  
    if ans > 1000000000000000000:
      ans(-1);
      break;

Submission status: Runtime Error

Solution code:
n =int(input())
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in ls:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
			break;
		
print(ans)

Submission status: Runtime Error

Solution code:
n =int(input())
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in A:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
			break;
		
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input());
ls=list(map(int,input().split()))
ans=1;
for i in ls:
	ans=i*ans;
if(ans<10**18):
	ans=-1;
	break;
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input());
ls = list(map(int,input().split()))
ans=1;
for i in ls:
ans=ans*i;  
if(ans>10**18)
print(-1);
else
print(ans);

Submission status: Runtime Error

Solution code:
n=int(input());
ls=list(map(int,input().split()))
ans=1;
for i in ls:
ans=ans*i;  
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np 
inf = 10**18
n = int(input())
A = list(map(int,input().split()))
S = np.prod(A)
if 0 in A:
	print(0)
    break
if S > inf:
	print("-1")
	break
print(S)

Submission status: Runtime Error

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
if 0 in a:
  print(0)
  break
A = 1
for i in range(N):
  A = A * a[i]
  if A > 1000000000000000000:
    print(-1)
    break
print(A)

Submission status: Runtime Error

Solution code:
import numpy as np 
inf = 10**18
n = int(input())
A = list(map(int,input().split()))
S = np.prod(A)
if A > inf;
	print("-1")
  else:
    print(S)

Submission status: Runtime Error

Solution code:
n = int(input())
li =list(map(int,input().split())
p = 1
for i in li:
  p = p * i
if p>pow(10,18):
  print(-1)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
n = int(input())
li =list(map(int,input().split())
if 0 in li:
  print(0)
else:
  prd = 1
  for I in li:
    prd = prd * I
  if prd>pow(10,18):
    print(-1)
  else:
    print(-1)

Submission status: Runtime Error

Solution code:
_LIMIT = 10**18

N = int(input())
result = 1
for i in range(N):
  ai = int(input())
  result *= ai
  
if result > _LIMIT: result = -1
  
print(result)

Submission status: Runtime Error

Solution code:
n, *l = map(int, open(0).read.split())

a = 1
for i in l:
	a *= i
	if a > 1e18:
		a =-1
		break
print(a)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
p = 1
for i in a:
	p*=i
	if p==0:
    	break
	if p>10**18:
		p=-1
        break
if p>10**18:
	p=-1
print(p)

Submission status: Runtime Error

Solution code:
a=input()
x = list(map(int, input().split()))
x.sort(reverse=true)
if x[-1]==0:
  print(0)
else:
  sum=1
  for i in x:
    sum*=i
    if sum>10**18:
      print(-1)
      break
  if sum<=10**18: print(sum)

Submission status: Runtime Error

Solution 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)

Submission status: Runtime Error

Solution code:
p=int(input())
ans=1
ar=[map(int,input().split())]
if 0 in ar:ans=0
else:
    for i in range(p):
        if ans<1e18:ans*=ar[i]
        else:ans=-1;break
    
print(ans,end='')

Submission status: Runtime Error

Solution code:
n = input()
lista = list(map(int,input().split()))
r = 1

if 0 in a:
  print(0)
else:
  for a in lista:
    r *= a
    if r > 10**18:
      print(-1)
      break
  else:
    print(r)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
a  = list(map(int, input().split()))

if 0 in a:
  print(0)
  return

res = 1
for num in a:
  res *= a
  if res > 1000000000000000000:
    print(-1)
    return

print(res)

Submission status: Runtime Error

Solution code:
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))
  print(c)

  if 0 in list:
    print(0)

  a = reduce(mul, list)

  if a > 1000000000000000000:
    print('-1')
  else:
    print(a)

main()

Submission status: Runtime Error

Solution code:
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))
  print(c)

  if 0 in list:
    print(0)

  a = reduce(mul, list)

  if a > 1000000000000000000:
    print(-1)
  else:
    print(a)

main()

Submission status: Runtime Error

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

ans = 1

import sys

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

for a in A:
  ans *= a
	if ans > pow(10, 18):
  	print(-1)
  	sys.exit()

print(ans)

Submission status: Runtime Error

Solution 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 ()

Submission status: Runtime Error

Solution code:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper && flag != 0:
    flag = 2
  if num == 0:
    flag = 0
if flag == 2:
  print(-1)
else:
  print(sum * flag)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(int(i) for i in input().split())

s == 1
for i in range(n):
	s *= a(i)
	if s > 10**18:
		print('-1')
	else:
		print(s)

Submission status: Runtime Error

Solution code:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper:
    flag = 0
  elif num == 0
    sum = 0
if flag == 1:
  print(sum)
elif:
  print(-1)

Submission status: Runtime Error

Solution code:
n = int(input())
lists = list(int(input()) for i in range(n))
number = 1
for j in lists:
  if number == 0:
    number = 0
    break
  number = number * j
  if number > 10**18:
    number = -1
    break
print(number)

Submission status: Runtime Error

Solution code:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
i = 0
flag = 0
upper = pow(10, 18)
for i in nums:
  sum *= nums[i]
  if sum > upper:
    print(-1)
    flag = 1
    break
if flag == 0:
    print(sum)

Submission status: Runtime Error

Solution code:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
i = 0
upper = pow(10, 18)
for i in nums:
  sum *= nums[i]
  if sum > upper:
    print(-1)
    exit()
print(sum)

Submission status: Runtime Error

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

if 0 in A:
  print(0)
  return

ans = 1
for a in A:
  ans *= a
  if ans > 1000000000000000000:
    print(-1)
    return
  
print(ans)

Submission status: Runtime Error

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

if 0 in A:
  print(0)
  return

ans = 1
for a in A:
  ans *= a
  if ans > 1000000000000000000:
    print(-1)
    return
  
print(ans)

Submission status: Runtime Error

Solution code:
import numpy
n = int(input())
A = map(int, input().split())
ans = numpy.prod(A)
if ans > 10 ** 8:
  print(-1)
else:
  print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
A = [int(input()) for i in range(5)]

j = 1

for a in A:
    j *= a
    if j > 1000000000000000000:
        print(-1)


print(j)

Submission status: Runtime Error

Solution code:
a,b=[int(i) for i in input().split()]
if(a*b>10000000000000000000):
  print(-1)
else:
  print(a*b)

Submission status: Runtime Error

Solution code:
n = int(input())
A =  [input() for i in range(n)]

j = 1

for a in A:
    j *= a
    if j > 1000000000000000000:
        print(-1)
        

print(j)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = list(map(int,input().split()))
r =np.prod(a)
if r >= 10**18:
  print(-1)
else:
  print(r)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
  print(0)
prod = 1
for i in range(n):
  prod *= a[i]
  if prod >= 10 ** 18:
    print(-1)
  	exit()
print(prod)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
c = 1

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

for i in range(len(a)):
    c = c * a[i]
    if c > pow(10,18):
        print(-1)
        exit(0)

print(c)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a_lst = list(map(int,input().split()))

ans = np.prod(a_lst)
if ans > 10**18
    print("-1")
else:
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a_lst = list(map(int,input().split()))

ans = 1
for a in a_lst:
    ans = ans * a
if ans > 10**18:
    print("-1")
else:
    print(ans

Submission status: Runtime Error

Solution code:
N = int(input())

P = int(input())

out_range = 10**18

for i in range(N-1):
    tmp = int(input())
    if  P > out_range or tmp > out_range:
        print(-1)
        exit()
    if tmp == 0:
        print(0)
        exit()
    P = tmp * P

print(P)

Submission status: Runtime Error

Solution code:
n = int(input())
A = map(int, input().split())

if 0 in A:
  return 0

product = 1

for a in A:
  product *= a

  if product > 10 ** 18:
    return -1

  return product

Submission status: Runtime Error

Solution code:
N = int(input())

P = int(input())

out_range = 10**18

for i in range(N-1):
    tmp = int(input())
    if  P > out_range or tmp > out_range:
        print(-1)
    P = tmp * P

print(P)

Submission status: Runtime Error

Solution code:
N = int(input())

P = int(input())

out_range = 10**18
for i in range(N-1):    
    tmp = int(input())
    if  P > out_range || tmp > out_range:
        print(-1)
    P = tmp * P

print(P)

Submission status: Runtime Error

Solution code:
n=int(input())
A=map(int,input().split(" "))
ans=1
POW=pow(10,18)
check=False
for i in range(n):
  ans*=A[i]
  if ans>POW:
    print(-1)
    check=True
    ans=0
if check==False:
  print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
t = int(input())
list_v = list(map(int,input().split()))
 
res = 1
for v in list_v:
  if v == 0:
    return 0
  res = res * v
  if res > 10**18:
    res = -1
    break
print(res)

Submission status: Runtime Error

Solution code:
t = int(input())
list_v = list(map(int,input().split()))

res = 1
for v in list_v:
  if v = 0:
    return 0
  res = res * v
  if res > 10**18:
    res = -1
    break
print(res)

Submission status: Runtime Error

Solution code:
N = input()
A = list(map(int,input().split()))
mult = 1
for i in range(N):
  mult *= A[i]
  if mult > 1e18:
    break

if mult > 1e18:
  print(mult)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
ans=1
A=list(map(int,input().split()))
while ans<10**18:
    for i in A:
        ans*=i
if ans>=10**18
    print(-1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
ans=1
for i in range(N):
  A=int(input())
  ans*=A
if ans>1000000000000000000:
  print(-1)
else:
  print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
a = 0
for i in range(1,N):
    if  (a *=N) > 10000000000000000000:
        print(-1)
    else:
        print(a*=N)

Submission status: Runtime Error

Solution code:
n = int(input())
m = 1
ans = 1
for _ in range(n):
  k = int(input())
  m = m*k
  if m>1000000000000000000:
    ans=-1
    break
if ans==-1:
  print(ans)
else:
  print(m)

Submission status: Runtime Error

Solution code:
tle = 10**18
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    res *= a[i]
if res > tle:
    res = -1

print(res)

Submission status: Runtime Error

Solution code:
t = int(input())
res = int(1)
flag = int(1)
x = int(0)
for i in range (t):
  x = int(input())
  res = res*x
  if res > 1e18:
    print("-1")
    flag = 0
if flag == 1:
  print(res)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
a=[int(x) for x in input().split()]
a_log=[]
for i in a:
  if i == 0:
    i+=10**(-1000000)
  i_log=math.log10(i)
  a_log.append(i_log)
  
if sum(a_log)>18:
  print("-1")
else:
  for i in range(n-1):
  	a[i+1]*=a[i]
  if a[n-1]>10**18:
    print("-1")
  else:
    print(a[n-1])

Submission status: Runtime Error

Solution code:
import math
n=int(input())
a=[int(x) for x in input().split()]
a_log=[]
for i in a:
  i_log=math.log10(i)
  a_log.append(i_log)
  
if sum(a_log)>18:
  print("-1")
else:
  for i in range(n-1):
  	a[i+1]*=a[i]
  print(a[n-1])

Submission status: Runtime Error

Solution code:
n = int(input())
arr = [int(x) for x in input().split()]
goukei = 1
ok = 1
if 0 in arr:
  print(0)
for i in arr:
  goukei *= arr[i]
  if goukei > 1000000000000000000:
    print(-1)
    ok = 0
    break
if ok = 1:
  print(goukei)

Submission status: Runtime Error

Solution code:
n = int(input())
arr = [int(n) for n in input().split()]
goukei = 1
ok = 1
if 0 in arr:
  print(0)
  ok = 0
for i in arr:
  goukei *= i
  if goukei > 1000000000000000000:
    print(-1)
    ok = 0
    break
if ok = 1:
  print(goukei)

Submission status: Runtime Error

Solution code:
n = int,input()
a = list(map(int,input().split()))
x = 1
for i in range(n):
  x *= a[i]
  if x > 1000000000000000000:
    x = -1
    break
print(x)

Submission status: Runtime Error

Solution code:
n = tuple,input()
a = list(map(tuple,input().split()))
x = 1
for i in range(n-1):
  x *= a[i]
  if x > tuple(1000000000000000000):
    x = tuple(-1)
    break
print(x)

Submission status: Runtime Error

Solution code:
n = int,input()
a = list(map(int,input().split()))
x = 1
for i in range(n-1):
  x *= a[i]
  if x > 1000000000000000000:
    x = -1
    break
print(x)

Submission status: Runtime Error

Solution code:
n = int,input()
a = list(map(int,input().split()))
x = 1
for i in range(n):
  x *= a[i]
  if x > 10^18:
    x = -1
    break
print(x)

Submission status: Runtime Error

Solution code:
n = int,input()
a = list(map(int,input().split()))
x = 1
for i in range(n):
  x *= a[i]
if x > 10^18:
  x = -1
print(x)

Submission status: Runtime Error

Solution code:
n = int,input()
a = list(map(int,input().split()))
x = 1
for i in range(n):
  x *= a[n]
  if x > 10^18:
    x = -1
    break
print(x)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
sum = 1
for i in a:
  sum *= i
  if sum > 1e18:
  print(-1)
  return
print(sum)

Submission status: Runtime Error

Solution code:
x = input()
t = int(x)
x2 = input()
n = list(map(int, x2.split(" ")))


def main():
  p = 1
  for v in t:
    p *= n[v]
    if (p >= 10 **18):
      print("-1")
      return
  print(p)

main()

Submission status: Runtime Error

Solution code:
import numpy
n = map(int, input())
a = input().split()

if(numpy.prod(a) > 10**18):
  print(-1)
else:
  print(numpy.prod(a))

Submission status: Runtime Error

Solution code:
str_num = input()
num_list = str_num.split()

answer = 1
for i in range(1, int(num_list[0])+1):
    answer *=int(num_list[i])
    if answer >= 10**18:
        answer = -1
        break

print(answer)

Submission status: Runtime Error

Solution code:
t = int(input())
lst = map(int,raw_split())
sum = 0
for i in range(t):
  sum *= lst[i]
if(sum <= 10000000000000000000000000000000000000000000):
  print(sum)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
N = input()
x = list(map(int,input().split()))
 
z = 1
if 0 in x:
  print(0)

for a in x:
  z *= a
  if z > 1000000000000000:
    print(-1)
    return
  
print(z)

Submission status: Runtime Error

Solution code:
N = input()
x = list(map(int,input().split()))

z = 1	
for a in x:
  z *= a
  if z >= 10**18:
    break
    print(-1)
  
if z<10**18
  print(z)

Submission status: Runtime Error

Solution code:
A, B=input().split()
b=float(B)*100
result=int(A)*int(b)
answer=round(result/100,2)
print(int(answer))

Submission status: Runtime Error

Solution code:
N = input()

    ab = input( )

    ab = ab.split()
    
    if 0 in ab:
        print(0)


    SUM = 1
    for i in range(int(N)):
        SUM = SUM * int(ab[i])
        if (int(SUM) < 10 ** 18):
            print(SUM)
        else:
        print(-1)

Submission status: Runtime Error

Solution code:
def main():
    N = input()

    ab = input( )

    ab = ab.split()
    
    if 0 in ab:
        print(0)


    SUM = 1
    for i in range(int(N)):
        SUM = SUM * int(ab[i])
         if (int(SUM) < 10 ** 18):
        	print(SUM)
        else:
        print(-1)
        
main()

Submission status: Runtime Error

Solution code:
def main():
    N = input()

    ab = input( )

    ab = ab.split()
    
    if 0 in ab:
        print(0)


    SUM = 1
    for i in range(int(N)):
        SUM = SUM * int(ab[i])
         if (int(SUM) < 10 ** 18):
        print(SUM)
        else:
        print(-1)
        
main()

Submission status: Runtime Error

Solution 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 ()

Submission status: Runtime Error

Solution code:
ab = input( )

ab = ab.split()

SUM = 1
for i in range(int(ab[0])):
    SUM = SUM * int(ab[i+1])
    
if (int(SUM) < 10 ** 18):
    print(SUM)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
N = input()

A = []

for i in range(1,int(N)+1):
    a = input()
    A.append(a)

SUM = 1
for i in range(len(A)):
    SUM = SUM * int(A[i])
    
if (int(SUM) < 10 ** 18):
    print(SUM)
else:
    print(-1)

Submission status: Runtime Error

Solution 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:
       prot *=a
       if prod>1000000000000000000:
          print (-1)
          return

    print(prod)

main()

Submission status: Runtime Error

Solution 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:
       prot *=a
       if prod>1000000000000000000:
          print (-1)
          return

    print(prod)

main()

Submission status: Runtime Error

Solution 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 ()

Submission status: Runtime Error

Solution code:
import math
 
n=int(input())
arr=list(map(int,input().split()))
ans=1
for i in range(n):
  ans *= arr[i]
if math.log10(ans) > 18:
  print("-1")
else:
  print(ans)

Submission status: Runtime Error

Solution 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:
       prot *=a
       if prod>1000000000000000000:
          print(-1)
          return

    print(prod)

main()

Submission status: Runtime Error

Solution code:
n=input()
A=eval('*'.join(input().split()))
print(-1 if A>10**18 else A)

Submission status: Runtime Error

Solution code:
_=input()
A=eval('*'.join(input().split()))
print(-1 if A>10**18 else A)

Submission status: Runtime Error

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
last = 1
if 0 not in b:
  for i in b:
      last*=i
      if last > 10**18:
      	last = -1
        break

else:
  last = 0
    
print(last)

Submission status: Runtime Error

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
last = 1
for j,i in enumerate(b):
    last*=i
    if last > 10**18 and 0 not in b[j:]:
    	last = -1
        break


    
print(last)

Submission status: Runtime Error

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
last = 1
for j,i in enumerate(b):
    last*=i
    if last > 10**18 and 0 not in b[j::]:
    	last = -1
        break


    
print(last)

Submission status: Runtime Error

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
last = 1
for i in b:
    last*=i
    if last > 10**18:
    	last = -1
        break
    
print(last)

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
num_list = list(map(int, input().split()))
c = 1
if 0 in num_list:
    print(0)
    sys.exit(1)
    
for i in range(N):
        c = c * num_list[i]

if c <= 10 ** 18:
    print(c)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    GI()
    CEIL = 10 ** 18

    xs = LGIS()

    prod = 1
    for x in GIS():
        prod *= x
        if prod > CEIL:
            prod = -1
            break

    if prod == -1:
        print(0 if 0 in xs else -1)
    else:
        print(prod)

main()