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())
data=list(map(int,input().split()))
num=1
for i in data:
    num*=i
if 10**18<num:
    print(-1)
else:
    print(num)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = [int(v) for v in input().split()]

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = input()
N = int(N)
A = [int(x) for x in input().split()]
a = 1
for i in range(N):

    a = a * A[i]

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
An_all = input().split()
An = []
for i in range(N):
    An.append(int(An_all[i]))

mult = 1
for i in range(N):
    mult = mult * An[i]

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

ans = 0

for a_i in a:
    if ans == 0:
        ans = a_i
    else:
        ans *= a_i

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
for i in a:
    ans *= i
    if (ans > pow(10,18)):
        flag = True

if (flag):
    ans = -1
if 0 in a:
    ans = 0

print(ans)

Submission status: Time Limit Exceeded

Solution code:
a=1
n=int(input())
li = list(map(int, input().split()))
for i in range(n):
    a=a*li[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()))
m=1
for i in range(n):
  m=m*a[i]
if m>10**18:
  print(-1)
else:
  print(m)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
n_list = [int(i) for i in input().split()]
ans = 1
n_list.sort()
for i in n_list:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 1
check = 10 ** 18

for i in range(N):
    ans *= A[i]

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
list=input().split(" ")
ans=1
for i in range(n):
    ans=ans*int(list[i])
    

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

Submission status: Time Limit Exceeded

Solution code:

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [int(a) for a in input().split()]

ans = 1

for a in range(0,N):
	ans = ans * A[a]


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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
num = input()
data = input().rstrip().split(" ")
ans = 1
for i in data:
    ans = ans*int(i)
if ans > 1000000000000000000:
    ans = -1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
n = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= A[i]
if(ans > 1000000000000000000):
    print("-1")
else:
    print(ans)

Submission status: Time Limit Exceeded

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


ans=1
for i in a:
    ans*=i
    if 0 in a:
        print(0)
        exit()
    elif 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
if 0 in A:
    print(0)
else:
    for a in A:
        ans *= a
        if ans > 10 ** 18:
            ans = -1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

ans = nums[0]

for x in range(N - 1):
    ans = ans * nums[x + 1]


if ans > 1000000000000000000:
    print("-1")
else:
    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]

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

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

r = 1
for a in A:
    r *= a

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    A_list = [A for A in input().split()]
    A_list = list(map(int, A_list))
    ans = 1
    for a in A_list :
        ans = ans * a
        if ans == 0 :
            break
    if ans > 10 ** 18 :
        ans = -1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = []

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

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

a = 1

for i in b:
  a = a * i

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

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]
print(ans if ans <= 10**18 else '-1')

Submission status: Time Limit Exceeded

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


if A.__contains__(0):
    print(0)
else:
    Con = 10**18
    ans = functools.reduce(lambda a,b: a*b,A)
    print(ans if ans<=Con else "-1")

Submission status: Time Limit Exceeded

Solution code:
import sys

def input():
    return sys.stdin.readline().strip()

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

Submission status: Time Limit Exceeded

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

def main(ar):
    ans = 1
    for i in ar:
      ans *= i
    return ans
ans = main(ar)
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()))
s=1
ans=0
for i in a:
  s=s*i
  if s>10**18:
    ans=1
   
  else:
    ans=0
    
if ans==1:
  print(-1)
  
else:
  print(s)

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]

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()))
B = 1
for i in range(N):
    B = B * A[i]
if B <= 10 ** 18:
    print(B)
else:
    print(-1)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
arr=list(map(int,input().split()))
c=1
arr.sort()
d=0
for i in arr:
    c=c*i
    if(c>10**18):
        d=1
        print(-1)
if(d==0):
    print(c)

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())
lst = [int(i) for i in input().split()]
ans = 1
for i in lst:
    ans *=  i#input().split()
if(ans > 1.0e+18):
    print(-1)
    exit()

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
f=0
l=list(map(int,input().split(' ')))
p=1
for x in l:
  if f==0:
    p*=x
if p>1000000000000000000:
    f=1
if f==1:
  print('-1')
else:
  print(p)

Submission status: Time Limit Exceeded

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

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

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

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 >= 1000000000000000001:
    print(-1)
    exit()
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = input().split(' ')
ans = 1
for t in a:
    ans *= int(t)

if ans > 1000000000000000000:
    print("-1")
else:
    print("{}".format(ans))

Submission status: Time Limit Exceeded

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

ans=1
for i in range(n):
    ans=ans*list[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()))
b = 1
for i in range(n):
    b = b * a[i]

if b > 10**18:
    b = -1
print(b)

Submission status: Time Limit Exceeded

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

from functools import reduce as r
from operator import mul

ans=r(mul,a)

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

Submission status: Time Limit Exceeded

Solution code:
_ = 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:
N = int(input())
input_list = input().split()

sum_num = 1
for t in input_list:
    sum_num *= int(t)

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce

n = int(input())

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

if min(an) == 0:
    print(0)
else:
    calc = reduce(mul, an)
    if calc >10 ** 18:
        print(-1)
    else:
        print(calc)

Submission status: Time Limit Exceeded

Solution code:
n = input()
a = list(map(int, input().split()))
t = 1
for i in a:
        t = t * i
print(t if t <= (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 range(N):
  if(0 in a):
    ans = 0
    break
  ans *= a[i]
  if(ans>10**18):
    ans = -1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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]

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

else:
    print(ans)

Submission status: Time Limit Exceeded

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

result = 1
for num in li:
  result = result * num
  
if result > 10 ** 18:
  print(-1)
else:
  print(result)

Submission status: Time Limit Exceeded

Solution code:
def multiplyList(myList) : 
      
    # Multiply elements one by one 
    result = 1
    for x in myList: 
         result = result * x  
    return result

n = int(input())
l = list(map(int, input().split()))
res = multiplyList(l)
if(res > 10**18):
    print(-1)
else:
    print(res)

Submission status: Time Limit Exceeded

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

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

max = 10 ** 18
if result > max:
    result = -1

print(result)

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    A = [int(_) for _ in input().split()]



    result = 1
    for i in A:
        result = result * i

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)
n = int(input())
a = list(map(int, input().split()))
res = prod(a)
if(res > 10**18):
    print(-1)
else:
    print(res)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

ans = 1

for i in range (N):
    ans *= pre[i]



if ans > 1000000000000000000:
    print("-1")

else:
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 1

for e in num_list:
    ans *= e

if ans > 1000000000000000000:
    print("-1")
else:
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 1

if min(A) == 0:
  print(0)

else:
  for i in range(N):
    ans *= int(A[i])
  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()))

results = A[0]
for i in range(N):
    if i==0:
        continue
    results *= A[i]

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = 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:
from operator import mul
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
M = 10**18
ans = reduce(mul, a)
if ans > M:
	print(-1)
else:
	print(ans)

Submission status: Time Limit Exceeded

Solution code:

if __name__ == '__main__':
    a = int(input())
    b = [int(i) for i in input().split()]
    ans = 1
    b.sort(reverse=True)
    for i in b:
        if  0 in b:
            ans = 0
            break
        ans = ans*i
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce

import sys
input = sys.stdin.readline

n = input()
n_list = list(map(int, input().split()))
n_value = (reduce(mul, n_list))

if n_value > 10**18:
    n_value = -1
print(n_value)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

A = list(map(int,input().split()))
ans = 1
if 0 in A:
    print(0)
else:
    for i in A:
        ans *= i

    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()))
a = 1
for i in A:
    a = a * i
if a > 1000000000000000000:    
    print(-1)
else:
    print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

sum = 1
for num in nums:
    sum *= num

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

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil, factorial, log,tan,pi,cos,sin,radians
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
from fractions import Fraction
from functools import reduce
from decimal import *
import string
import sys
import os
import re
inf = float('inf')
mod_ = int(1e9) + 7
mod = 998244353

def factors(n):
    from functools import reduce
    return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def sieve(m):
    n=1
    primes = {}
    arr=set([])
    for i in range(2, int(m ** 0.5) + 1):
        a = n // i
        b = m // i
        for k in range(max(2, a), b + 1):
            c = i * k
            primes[c] = 1

    for i in range(max(n, 2), m + 1):
        if i not in primes:
            arr.add(i)

    return arr


class DisjointSetUnion:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
 
    def find(self, a):
        acopy = a
        while a != self.parent[a]:
            a = self.parent[a]
        while acopy != a:
            self.parent[acopy], acopy = a, self.parent[acopy]
        return a
 
    def union(self, a, b):
        a, b = self.find(a), self.find(b)
        if a != b:
            if self.size[a] < self.size[b]:
                a, b = b, a
 
            self.num_sets -= 1
            self.parent[b] = a
            self.size[a] += self.size[b]
 
    def set_size(self, a):
        return self.size[self.find(a)]
 
    def __len__(self):
        return self.num_sets



def main():
    n=int(input())
    prod=1
    arr=list(map(int,input().split()))
    for i in arr:
        prod*=i

    if prod>10**18:
        print(-1)
        exit()
    print(prod)
    # n,m=
    # print(n*m)












    



# region fastio

BUFSIZE = 8192

class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 1
an = list(map(int,input().split()))
for i in an:
    if i == 0:
        ans = 0
if ans != 0:
    for i in range(n):
        ans = ans * an[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()))

answer = 1

for i in range(N):
  answer = answer * A[i]

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
#import numpy as np
n=int(input())
l1=list(map(int,input().split(" ")))
sum=1
for i in l1:
    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()))

result = 1
for a in A:
  result *= a
  
if result > 1e18:
  print(-1)
else:
  print(result)

Submission status: Time Limit Exceeded

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

ans=1
max=10**18
overflg=False
for i in numlist:
  ans *= int(i)

if ans > max:
  print("-1")
else:
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans=1;
for a in input().split():
    ans*=int(a)
if (ans>1000*1000*1000*1000*1000*1000):
    print(-1)
else:
    print(ans)

Submission status: Time Limit Exceeded

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

M_NUM = 10**18

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

if ans > M_NUM:
    print('-1')
else:
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

a=[]


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


c=int(a[0])

for k in range(1,n):

    c*=int(a[k])

if c>10**18:
    print(-1)

else:
    print(c)

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

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

main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

N = int(input())
A = list(map(int, input().split()))
ans = reduce(lambda x0, x1: x0 * x1, A)
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=a[0]
for i in range(1,n):
  ans*=a[i]
print(ans if ans<=10**18 else -1)

Submission status: Time Limit Exceeded

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

ans = 1

for i in range(N):
    ans *= L[i]

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=[int(i) for i in input().split()]
p=l[0]
if(0 in l):
    print(0)
else:
    for i in range(1,n):
        p*=l[i]
        if(p>pow(10,18)):
            p=-1
    print(p)

Submission status: Time Limit Exceeded

Solution code:
# import numpy as np

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

p = 1
for i in a:
    p *= i



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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
n = int(input())
la = list(map(int, input().split()))
ans = 1
for i in la:
  ans *= i

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

Submission status: Time Limit Exceeded

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

ans = 1
n = int(input())
arr = list(map(int , input().split()))
for i in range(n):
	ans*=arr[i]
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
for i in range(N):
    ans *= A[i]
    if ans > 10**18 and 0 not in A:
        print(-1)
        break

if ans <= 10**18:
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0
for i in A:
    if ans != 0:
        ans = ans * i
    else:
        ans = i

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

Submission status: Time Limit Exceeded

Solution code:
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
from collections import deque


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
	
def count_str(m):
	tmp={}
	for i in range(10):
		if i in tmp:
			tmp[i]=1
		else:
			tmp[i]+=1
	return tmp

def is_prime(n):
	if n==1: return True

	for i in range(2,int(math.sqrt(n))+1):
		if n%i==0:
			return False
	return True


n=input1()
A=input_array()
ans=1
flag=True
for a in A:
	ans=ans*a

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()))
sum=1
for n in A:
    sum=sum*n

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

print(sum)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline


n = int(input())
up = 10**18
l = list(map(int, input().split()))

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = [int(x) for x in input().split()]
s = 10 ** 18
ans = 1
for a in a_list:
    ans *= a
    if ans == 0:
        break
print(ans if ans <= s else -1)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
s=1
f=0
x=[int(x) for x in input().split()]
for i in range(len(x)):
    s=s*x[i]
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()))
seki = 1
for i in range(N):
  seki *= A[i]
if seki <= 10**18:
  print(seki)
else:
  print(-1)

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
lis = list(map(int,input().split()))
a = 1
for i in range(n):
    a = a*lis[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()))

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