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: Time Limit Exceeded

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

for i in range(len(a)):
    c = c * a[i]

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

Submission status: Time Limit Exceeded

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: Time Limit Exceeded

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

p = 1
for i in range(0,N):
  p = p * arr[i]

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

Submission status: Time Limit Exceeded

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

for n in A:
    ans *= n

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
A=list(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)
else:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
nums = [int(e) for e in input().split()]
ans = 1
for i in range(n):
    ans *= nums[i]
print(ans if ans <= 10 ** 18 else -1)

Submission status: Time Limit Exceeded

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

for i in a:
  ans *= i

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

print(ans)

Submission status: Time Limit Exceeded

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

m = 1
for _a in a:
  m *= _a
print(m if m <= 10**18 else -1)

Submission status: Time Limit Exceeded

Solution code:
t = int(input())
list_v = [int(x) for x in input().split()]

res = 1
for v in list_v:
  res = res * v
 
if res > 1000000000000000000:
	print(-1)
else:
	print(res)

Submission status: Time Limit Exceeded

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

kotae = 1
for i in range(n):
    kotae *= a[i]

if(kotae > 10 ** 18):
    kotae = -1

print(kotae)

Submission status: Time Limit Exceeded

Solution code:
N = input()
A = input().split(" ")

Ans = int(A[0])
flag = 0

for A_tmp in A:
  if flag == 1:
    Ans = Ans * int(A_tmp)
  flag = 1

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

print(Ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import numpy as np

n = int(input())
numlist = list(map(int, input().split()))
ans = 1;

for i in numlist:
    if i == 0:
        ans = 0
        break
    ans *= i
    
if ans > 10**18:
    ans = -1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import numpy as np

n = int(input())
numlist = list(map(int, input().split()))
ans = 1;

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = input("")
a = [int(n) for n in arr.split()]
ans = 1
for i in range(n):
    ans = ans * int(a[i])
if ans > int(1e18):
    print("-1")
else:
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
numlist=list(map(int,input().split()))
result=1
for x in numlist:
    result=result*x
if result<=1000000000000000000:
    print(result)
else:
    print(-1)

Submission status: Time Limit Exceeded

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

def caculate(n, number):
  a = number[0]
  for i in range(1, n):
    a = a*number[i]
  if a>1e18:
    return -1
  return a
print(caculate(n, number))

Submission status: Time Limit Exceeded

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

print(res)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a
print(ans if ans <= pow(10,18) else -1)

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
n = int(input())
A = list(map(int,input().split()))
S = reduce(lambda x, y: x * y, A)
if S > 10**18:
    print(-1)
else:
    print(S)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 1

for i in num_list:
    ans *= i

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

Submission status: Time Limit Exceeded

Solution code:
n = input()
l = map(int, raw_input().split())
ans = 1
for i in l:
    if (ans * i) <= 1e18:
        ans = ans * i
    else:
        ans = -1
print(ans)

Submission status: Time Limit Exceeded

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

res = 1

for i in l:
    res *= i

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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


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

main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
inp = int(input())
lst = map(int,input().split())
sum = 1
for i in lst:
  sum *= i
  
if sum <= 1e18:
  print(sum)
else:
  print(-1)

Submission status: Time Limit Exceeded

Solution code:
#
import sys
import math
import numpy as np
import itertools

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

for i in range(n):
    a *= ll[i]
if a > 10**18:
    print(-1)
else:
    print(a)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import string

n = int(input())
a = list(map(int,input().split()))
res = 1
for i in range(n):
    res *= a[i]

if(res>pow(10,18)):
    print(-1)
else:
    print(res)

Submission status: Time Limit Exceeded

Solution code:
#
import sys
import math
import numpy as np
import itertools

n = int(input())
a=1
ll = [int(i) for i in input().split()] 
for i in range(n):
    a *= ll[i]
if a > 10**18:
        print(-1)
else:
    print(a)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
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: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
c = int(input())
n_list = list(map(int, input().split()))

i = 1

for n in n_list:
    i = i * n

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=input()
a=list(map(int,input().split()));s=1
for i in a:
    s *=i
print(['-1',s][s<=10**18])

Submission status: Time Limit Exceeded

Solution code:
input()
b = [int(i) for i in input().split()]

if 0 not in b:
  last = 1
  for i in b:
      last*=i

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

else:
  last = 0
print(last)

Submission status: Time Limit Exceeded

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
    
print(last)

Submission status: Time Limit Exceeded

Solution code:
input()
l=list(map(int,input().split()))
ret=1
for i in l:
  ret*=i
print(ret if ret <= 10**18 else -1)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

result = 1
for a in list_A:
    result *= a

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

Submission status: Time Limit Exceeded

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

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

    prod = 1
    for x in GIS():
        prod *= x
        if prod > CEIL:
            prod = -1
    print(max(prod, -1))

main()

Submission status: Time Limit Exceeded

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

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

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

main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
v = [int(x) for x in input().split()]
ans = 1
for i in range(n):
    ans*=v[i]
if ans <= (10**18):
	print(ans)
else:
    print(-1)

Submission status: Time Limit Exceeded

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

t()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
if min(a) == 0:
  res = 0
else:
  for i in range(len(a)):
    res *= a[i]
    if res > 1000000000000000000:
      res = -1
      continue
print(res)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import math
n = int(input())
a = list(map(int, input().split()))
res = 1 
if min(a) == 0:
  res = 0
else:
  for i in range(n):
    res *= a[i]
    if res > 1000000000000000000:
      res = -1
      continue
print(res)

Submission status: Time Limit Exceeded

Solution code:
import sys
N=int(input())
a=list(map(int, input().split()))
s=1
if 0 in a:
    print(0)
    sys.exit()
for i in a:
    s*=i
if s>10**18:
    print(-1)
    sys.exit()
print(s)

Submission status: Time Limit Exceeded

Solution code:
import sys
N=int(input())
a=[int(N) for N in input().split()]
s=1
if 0 in a:
    print(0)
    sys.exit()
for i in range(N):
    s*=int(a[i])
if s>10**18:
    print(-1)
    sys.exit()
print(s)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
a=input().split(' ')
s=1
for i in range(N):
    s*=int(a[i])
if 0 in a:
    print(0)
if s<=10**18:
    print(s)
else:
    print("-1")

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
a=input().split(' ')
s=1
for i in range(N):
    s*=int(a[i])
if s<=10**18:
    print(s)
else:
    print("-1")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
lst = list(map(int,input().split()))
res = 1
for i in lst:
    res *= i
if res > 1000000000000000000:
    print(-1)
else:
    print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
N=int(input())
if N>10**5 or N<2:
    sys.exit()
a=input().split(' ')
if N<len(a):
    sys.exit()
s=1
for i in range(N):
    s*=int(a[i])
if s<=10**18:
    print(s)
else:
    print("-1")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
m=1
inf=10**18
lol=0
l=list(map(int,input().split()))
if 0 in l:
    print(0)
else:

    for i in l:
      m=m*i
      if(m>inf):
        lol=1
    if(lol):
      print(-1)
    else:
      print(m)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
m=1
inf=10**18
lol=0
l=list(map(int,input().split()))
for i in l:
  m=m*i
if(m>inf):
  print(-1)
else:
  print(m)

Submission status: Time Limit Exceeded

Solution code:
from sys import *
from collections import *
from math import *

input = stdin.readline

n = int(input())
arr = list(map(int, input().split()))
mul = 1
for x in arr:
	mul *= x
if mul > 10 ** 18:
	mul = -1
print(mul)

Submission status: Time Limit Exceeded

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

main()

Submission status: Time Limit Exceeded

Solution code:
n = eval(input())
a = input().split()
prod = 1
for i in range(0, n):
    prod *= int(a[i])
if prod > 1e18:
    print(-1)
else:
    print(prod)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# 制約条件
MAX_RESULT = 1000000000000000000

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

tmp = 1

for x in range(len(A1)):
    tmp = tmp * A1[x]

result = tmp

if (result > MAX_RESULT):
    result = -1

print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = a[0];
for i in range(n-1):
  b *= a[i+1]

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

Submission status: Time Limit Exceeded

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

ans = 1
for i in range(n):
    ans *= l[i]

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

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    n=int(input())
    listA=[]
    listA=list(map(int,input().split()))


    all=listA[0]
    for i in range(n-1):
        all=all*listA[i+1]
    if all>10**18:
        print("-1")
    else:
        print(all)
resolve()

Submission status: Time Limit Exceeded

Solution code:
import sys

N = int(input())
A = map(int, input().split())

ans = 1


for a in A:
    if a == 0:
        print(0)
        sys.exit()
    ans *= a

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

Submission status: Time Limit Exceeded

Solution code:
import sys

N = int(input())
A = map(int, input().split())

ans = 1

for a in A:
    ans *= a

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
n_list= list(map(int,input().split()))
if 0 in n_list :
  print('0')
else:  
  ans=1
  tho=10**18
  for i in range (N):
    ans*=n_list[i]
  if ans > tho :
    print('-1')
  else :
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
n_list=list(map(int,input().split()))
ans=1
tho=10**18
for i in range (N):
  ans*=n_list[i]
  if n_list[i]==0:
    print('0')
    quit()
if ans > tho :
  print ('-1')
elif ans <= tho :
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
n_list= list(map(int,input().split()))
ans=1
tho=10**18
for i in range (N):
  ans*=n_list[i]
  
if ans > tho :
  print ('-1')
elif ans <= tho :
  print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = map(int, input().split())
pro = 1
for n in arr:
    pro *= n
if pro > 1000000000000000000:
    pro = -1
print(pro)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = map(int, input().split())
pro = 1
for n in arr:
    pro *= n
if pro > 10 ** 18:
    pro = -1
print(pro)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
sum = 1
for i in a:
    if i == 0:
        sum = 0
        break
    sum = sum * i

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
sum = 1
for i in a:
    sum = sum * i

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

Submission status: Time Limit Exceeded

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

T = 1
for i in A:
    T = T * i
if T > 10 ** 18:
    print(-1)
else:
    print(T)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
n_list= list(map(int,input().split()))
ans=1
for i in range (N):
  ans*=n_list[i]
if ans <= 10**18 :
  print(ans)
else :
  print('-1')

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
sum = 1
for i in range(n):
    sum = sum * a[i]

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

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

mul = A[0]
for i in A[1:]:
    mul *= i

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_n = input().split(' ')
ans = 1

for a in a_n:
    ans *= int(a)

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
l = list(map(int, input().split()))
sum = 1
for i in l:
    sum *= i
if sum > 1000000000000000000:
    print(-1)
else:
    print(sum)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
s=input().split()
result=1
for i in range (N):
  result=result*int(s[i])
if result<= 10**18:
  print(result)
else:
  print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
num = int(input())

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

a = 1

for i in list:
  a *= i

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

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

n  = input()
xs = map(int, input().split())

MAX  = 10 ** 18
OVER = MAX + 1

result = reduce(lambda x, acc: x * min(acc, OVER), xs)

if result <= MAX:
  print(result)
else:
  print(-1)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A_list = list(map(int, input().split()))
sum = 1
for i in range(N):
    sum = sum * A_list[i]

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
# B - Multiplication 2

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
lst = list(map(int, input().split()))
zero = False
fl = False
x = 1
for i in lst:
    if(i==0):
        zero = True
        break
    x*=i
    if(x>1e18):
        fl = True
if zero:
    print(0)
elif fl:
    print(-1)
else:
    print(x)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
s=input().split()
result=1
for i in range (N):
  result=result*int(s[i])
if result<= 10**18:
  print(result)
else:
  print(-1)

Submission status: Time Limit Exceeded

Solution code:
def main():
  count = int(input())
  data = map(int, input().split(" "))
  output = 1
  for i in data:
    output = output * i
  if output <= 10 ** 18:
    print(output)
  else:
    print(-1)

main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = list(map(int,input().split()))
m = 1
for i in range(0,N):
 	m = m * a[i]
if(m<=1000000000000000000):
    print(m)
else:
    print(-1)

Submission status: Time Limit Exceeded

Solution code:
def multi2():
    N = int(input())
    a = list(map(int,input().split()))
    m = 1
    for i in range(0,N):
        m = m * a[i]
    if(m<=1000000000000000000):
        return m
    else:
        return -1


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

Submission status: Time Limit Exceeded

Solution code:
def multi2():
    N = int(input())
    a = input().split()
    m = 1
    for i in range(0,N):
        m = m * int(a[i])
    if(m<=1000000000000000000):
        return m
    else:
        return -1


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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
lst = list(map(int, input().split(' ')))
ans = 1
for i in range(0, len(lst)):
  ans *= lst[i]
if ans > 1000000000000000000:
  print("-1")
else:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 1
arr = [int(x) for x in input().split()]
for each in arr:
    ans *= each
if (ans > 1e18):
    print(-1)
else:
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = input()
a = list(map(int,input().split()))
sum = 1
for i in a:
    sum*=i

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
li = list(map(int,input().split()))
C = 1
for i in range(N):
  C *= li[i]
if C <= 10 ** 18:
  print(C)
else: print(-1)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=list(map(int,input().split()))
if S[0]==0:
  print(0)
else:
  X=S[0]
for i in range(1,N):
  if S[i]==0:
    X=0
    print(0)
    break
  else:
    X=X*S[i]
    #print(X)   
if 0<X<=10**18:
  print(X)
else:
  if X!=0:
    print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
i = 0
p = 1
while i < n:
    p *= a[i]
    i += 1

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

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
lp = int(input())
arr = list(map(int, input().split(" ")))

def mul(x, y):
    value = x * y
    if value > 10**18:
        return -1
    else:
        return x*y

k = reduce(mul, arr)
print(k)

Submission status: Time Limit Exceeded

Solution 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]*ans
        if ans >10**18:
            ans =-1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
num = input()
a = input().split()

b=1
if '0' in a:
	b = 0
else:
	for i in a:
		b *= int(i)

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

print(b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
li = list(map(int, input().split()))
ans = 1
for e in li:
    ans *= e

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

Submission status: Time Limit Exceeded

Solution code:
num = input()
a = input().split()

b=1
for i in a:
	b *= int(i)

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

print(b)

Submission status: Time Limit Exceeded

Solution code:
import sys
def main():
    N=int(sys.stdin.readline())
    A=list(map(int,sys.stdin.readline().split()))
    x=1
    for a in A:x*=a
    if x>10**18:x=-1
    print(x)
if __name__=='__main__':main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

b = 1

a = list(map(int, input().split()))
for i, a in enumerate(a):
    try:
        b *= a
    except:
        print("-1")
if b > pow(10, 18):
    print("-1")
else:
    print(b)

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
n=input()
s=list(map(int,(input().split(" "))))
#s.sort()
ans=reduce(lambda x,y:x*y,s)
if ans > 1e18:
    print(-1)
else:
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=input()
s=list(map(int,(input().split(" "))))
s.sort()
ans=1
for i in s:
    ans*=i
if ans > 1e18:
    print(-1)
else:
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = input()

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

x = num_list[0]

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
b = 1
c = 1
p = 10**18
for i in range(N):
  if A[i] == 0:
    c = 0
    break
  else:
    ans *= A[i]
    if p < ans:
      b = -1
if c == 0:
  print(c)
elif b == -1:
  print(b)
else:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
for x in a:
  ans *= x
if (ans > 1000000000000000000):
  print("-1")
else:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
totalNumbers=int(input())
array=list(map(int,input().split()))
import math
answer=math.prod(array)
print(-1 if answer>10**18 else answer)

Submission status: Time Limit Exceeded

Solution code:
totalNumbers=int(input())
array=map(int,input().split())
current=1
for number in array:
  current*=number
print(-1 if current>10**18 else current)

Submission status: Time Limit Exceeded

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