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:
import math
import numpy as np
n=input()
list=list(map(int,input().split()))
list=np.array(list,int)

p=math.log10(list)
p=p.sum()
if p>=18:
  print(-1)
else:
  print(np.prod(list))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
ans=a*b
p=math.log10(ans)
if p>=18:
  print(-1)
else:
  print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
x = input().split()
a = 0
b = 1
while a <= n - 1 or b > 10^8:
  b = b * int(x[a])
  a += 1
if b > 10^8:
  print('-1')
else:
  print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if 0 in a:
  print(0)
  exit()
total = 1 
for i in range(n):
  total* = a[i]
  if total > 10 ** 18:
  print(-1)
  break
print(total)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 1
for _ in range(N):
	ans *= int(input())
    if ans > 1e18:
    	ans = -1
        break
print(ans)

Submission status: Runtime Error

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

ans = 1

for i in A_list:
    if i == 0:
        print(0)
        exit(1)

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

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
p = [int(i) for i in input().split()]
ans = 1

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

Submission status: Runtime Error

Solution code:
N = int(input())
p = [int(i) for i in input().split()]
ans = 1

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

Submission status: Runtime Error

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

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

for i in range(n):
  ans*=ans*l[i]
  if ans > 10**18:
      print(-1)
      exit()

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
p=1
for i in range(1,n+1):
    x = int(input())
    p=p*x;
    if (p > 1000000000000000000):
        break;
if(p>1000000000000000000):
  print("-1")
else:
    print(p)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int, input().split()))
sum = 1
zero = 0
f = 0
N = 1e18
for num in l:
  if N/sum < num or (N/sum == num and N%sum): f =1
  sum *= num
if not f: print(sum)
else: print("-1")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
D=False
ans=1
List=list(map(int,input()split()))
if 0 in List:
  print(0)
else:
  for i in ragne(N):
    ans=ans*List[i]
    if ans>10**18:
      print(-1)
      D=True
      break
  if D==False:
    print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
from collections import deque
from collections import defaultdict
import itertools as it

#自作関数群
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()
def factorization(n):
  res = []
  if n%2==0:
    res.append(2)
  for i in range(3,math.floor(n//2)+1,2):
    if n%i==0:
      c = 0
      for j in res:
        if i%j==0:
          c=1
      if c==0:
        res.append(i)
  if len(res)==0:
    res = [n]
  return res
def fact2(n):
  p = factorization(n)
  res = []
  for i in p:
    c=0
    z=n
    while 1:
      if z%i==0:
        c+=1
        z/=i
      else:
        break
    res.append([i,c])
  return res
def fact(n):#階乗
  ans = 1
  m=n
  for _i in range(n-1):
    ans*=m
    m-=1
  return ans
def comb(n,r):#コンビネーション
  if n<r:
    return 0
  l = min(r,n-r)
  m=n
  u=1
  for _i in range(l):
    u*=m
    m-=1
  return u//fact(l)
def combmod(n,r,mod):
  return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
  r=copyQueue(q)
  ans=[0]*r.qsize()
  for i in range(r.qsize()-1,-1,-1):
    ans[i] = r.get()
  print(ans)
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1]*n

  def find(self, x): # root
    if self.parents[x]<0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self,x,y):
    x = self.find(x)
    y = self.find(y)

    if x==y:
      return

    if self.parents[x]>self.parents[y]:
      x,y = y,x

    self.parents[x]+=self.parents[y]
    self.parents[y]=x

  def size(self,x):
    return -1*self.parents[self.find(x)]

  def same(self,x,y):
    return self.find(x)==self.find(y)

  def members(self,x): # much time
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i)==root]

  def roots(self):
    return [i for i,x in enumerate(self.parents) if x<0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
  x = 1
  zero = "0"*n
  ans = []
  ans.append([0]*n)
  for i in range(2**n-1):
    ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
    x+=1
  return ans;
def arrsSum(a1,a2):
  for i in range(len(a1)):
    a1[i]+=a2[i]
  return a1
def maxValue(a,b,v):
  v2 = v
  for i in range(v2,-1,-1):
    for j in range(v2//a+1): #j:aの個数
      k = i-a*j
      if k%b==0:
        return i
  return -1
def copyQueue(q):
  nq = queue.Queue()
  n = q.qsize()
  for i in range(n):
    x = q.get()
    q.put(x)
    nq.put(x)
  return nq
def get_sieve_of_eratosthenes(n):
  data = [2]
  #data = [0,0,0]
  for i in range(3,n+1,2):
    data.append(i)
    data.append(0)
  for i in range(len(data)):
    interval = data[i]
    if interval!=0:
      for j in range(i+interval,n-1,interval):
        data[j] = 0
  ans = [x for x in data if x!=0]
  #ans = data[:]
  return ans


a,b = readInts()

#print(a+b)
print(a*b)

Submission status: Runtime Error

Solution code:
import math
from collections import deque
from collections import defaultdict
import itertools as it

#自作関数群
def readInt():

Submission status: Runtime Error

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

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

sortlist = list.sorted()

answer = 1

for a in sortlist:
    answer = answer*a
    if answer == 0:
        break
    if answer > 10^18:
        answer = -1
        break
    else:
        continue

print(answer)

Submission status: Runtime Error

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

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

sortlist = list.sorted()

answer = 1

for a in sortlist:
    answer = answer*a
    if answer == 0:
        break
    if answer > 10^18:
        answer = -1
        break
    else:
        continue

Submission status: Runtime Error

Solution code:
import math
from collections import deque
from collections import defaultdict
import itertools as it

#made by hageron
def readInt():

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 sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	a,b=MI()
	print(a*b)


if __name__ == "__main__":
	main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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


c=1
for x in a:
  c=c*int(x)
  
if c =< 10**18:
  print(c)
else:  
  print("-1")

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans=A[0]
for i in range(len(A)):
    ans*=A[i]

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

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans=A[0]
for i in range(len(A)):
    ans*=A[i]

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

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1;
tem = 0
ok = 1
s = input().split()
for i in s:
    if(int(i) == 0):
        tem = 1
        break
    ans *= int(i) 
    if(ans > 10**18):
        ok = 0
if(tem):
    print(0)
elif(ok)
    print(ans)
else:
    print("-1")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

#define int unsigned long long
using namespace std;

int digit(int a)
{
    int ret = 0;
    while (a >= 10)
    {
        ret++;
        a /= 10;
    }
    return ret;
}

signed main()
{
    int n, a, ans;
    ans = 1;
    cin >> n;
    bool flag = false;
    for (int i = 0; i < n; ++i)
    {
        cin >> a;
        if (digit(a) + digit(ans) > 18)
        {
            flag = true;
        }
        if (a == 0)
        {
            flag = false;
        }
        ans *= a;
    }

    if (ans > (int)pow(10, 18) or flag)
        cout << -1;
    else
        cout << ans;

    return 0;
}

Submission status: Runtime Error

Solution code:
import numpy as np

n = input()
li = list(map(float, input().split()))
result = np.prod(li)

if float(result) >= 1000000000000000001:
    print(-1)
else:
    print(int(result))

Submission status: Runtime Error

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

      if b>10**8:
        print(-1)
        return
   
  print(b)

f()

Submission status: Runtime Error

Solution code:
2
1000000000 1000000000

Submission status: Runtime Error

Solution code:
n = int(input())
arr = list(map(int, input().split()))
if 0 in arr:
  print(0)
else:
  mult = 1
  for i in arr:
    mult *= 1
    if mult > 1000000000000000000:
      print(-1)
      flag = 1
      break
  if flag != 1:
    print(mult)

Submission status: Runtime Error

Solution code:
n = int(input())
arr = list(map(int, input().split()))
if 0 in arr:
  print(0)
else:
  mult = 1
  for i in arr:
    mult *= 1
  if mult > 1000000000000000000:
    print(-1)
    flag = 1
    break
  if flag != 1:
    print(mult)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#intの場合
N = int(input()) #ここで標準入力

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

# multiple = 1
# for i in range(N):
#     multiple *= A[i]



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


if 0 in A:
    print(0)
    return

output = 1
for a in A:
    output *= a
    
    if output > 10 ** 18:
        print(-1)
        return

print(output)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
c = 10**18

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

for i in a:
    b *= i
    if b > c:
        print(-1)
        return

print(b)

Submission status: Runtime Error

Solution code:
c = 10**18

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

if 0 in a:
    print(0)
    return

for i in a:
    b *= i

if b > c:
    print('-1')
else:
    print(b)

Submission status: Runtime Error

Solution code:
#coding: utf-8
times= int(input())
a= 1
if 0 in times:
  print(0)
for i in list(map(int, input().split())):
  a*= i
  if a > 10**18:
    print('-1')
else:
  print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = input().split()
a_int = [int(n) for n in a]
ans = 1
for num in a_int:
    if ans !> 10**18:
        ans *= num
    else:
        print(-1)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
lst = sorted([int(x) for x in input().split() if x != "1"], reverse=True)
if lst[-1] == 0:
    print(0)
    exit()

ret = 1
for x in lst:
    ret *= x
    if ret > 10 ** 18:
        print(-1)
        exit()

print(ret)

Submission status: Runtime Error

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

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())
arr = list(map(int, input().split()))

while len(arr) > 1:
    m = len(arr)
    if m & 1:
        arr.append(1)
        m += 1

    left, right = arr[:n // 2], arr[n // 2:]
    arr = [x * y for x, y in zip(left, right)]

x = arr[0]
if x > 10 ** 18:
    print(-1)
else:
    print(x)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#define mod 1000000009
#define int signed long long int 
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int pow(int p,int r){
	int ans=1;
	while(r>0){
     if(r&1){
		 ans=((ans%mod)*(p%mod))%mod;
	 }
	 r=r>>1;
     p=((p%mod)*(p%mod))%mod;
	}
}
signed main() {
garou;
int n;
cin>>n;
int x=1;
int y=1000000000000000000;
int a[n],z=0;
for(int i=0;i<n;i++){
	cin>>a[i];
	if(a[i]==0)
    z++;
}
if(z>0)
cout<<0;
else{
for(int i=0;i<n;i++){
	if(a[i]<=y/x){
		x*=a[i];
	}
	else{
		x=-1;
		break;
	}
	
}
cout<<x;
}
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if min(a) ==0:
    ans =0
else:
    order =0
    for i in a:
        order = order+len(str(i))-1

    if order >18:
        ans = -1
    else:
        ans =1
        a = a.sort()
        for i in a:
                ans = ans*i
        if ans >10**18:
            ans=-1
print (ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
input = stdin

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from sys import exit
n = int(input())
a = list(map(int, input().split()))
a.sort(Reverse = True)
ans = 1
for i in a:
  ans *= i
  if (ans > 1e18):
    print(-1)
    exit(0)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

r = 1
t = 10 ** 18
for i in a:
  r *= a
  if r > t:
    print(-1)
    return
print(r)

Submission status: Runtime Error

Solution code:
a = int(input())

score = 1
for i in range(a):
  b = int(input())
  score *= b
 
if score > 10 ** 18:
  print(-1)
else:
  print(score)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
n=int(input())
i=list(map(int, input().split()))
k =np.prod(i)
if k=<10**18:
  print(k)
else:
  print("-1")

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
from decimal import Decimal

n = int(input())

arg = list(map(Decimal, input().split()))
ans = Decimal("1")

for m in arg:
    ans = ans * m

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

Submission status: Runtime Error

Solution code:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if math.log10(a) > 18:
        print(-1)
        exit()
    ans *= a
    elif ans % 10 == 0 and math.log10(ans) == 18:
        print(ans)
    elif math.log10(ans) > 18:
        print(-1)
        exit()
print(ans)

Submission status: Runtime Error

Solution code:
def main():

n=input()
a=map(int,input().split)
d=1

if 0 in a:
  print(0)
  return

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

def main():

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
n = int(input())
la = [int(i) for i in input().split()]
ans = 1
for a in la:
    ans *= a

if(math.log10(ans) > 18):
    print(-1)
else:
    print(ans)

Submission status: Runtime Error

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

ans = a[0]
a2 = a[1:]
for i in a2:
  ans = ans * i

if ans > 10e+18:
  ans = -1

print(ans)

Submission status: Runtime Error

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

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

for n in b:
    c = c*n
    if c > 10**18:
        print(-1)
        exit()

print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  limit= 10 ** 10
  for num in nums:
    n *=num
  	if num > limit:
  	  print(-1)
  	  return
  print(num)
  return
 
mp([int(x) for x in inp.split(" ")])

Submission status: Runtime Error

Solution code:
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  limit= 10 ** 10
  for num in nums:
    n *=num
  	if num > limit:
  		print(-1)
  		return
  print(num)
  return
 
mp([int(x) for x in inp.split(" ")])

Submission status: Runtime Error

Solution code:
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  for num in nums:
    n *=num
  	if num > limit:
  		print(-1)
  		return
  print(num)
  return
 
limit= 10 ** 10
num = mp([int(x) for x in inp.split(" ")])

Submission status: Runtime Error

Solution code:
inp=input()
nums = [int(x) for x in inp.split(" ")]

def mp(nums):
  n = 1
  for num in nums:
    n *=num
  return n

limit= mp([10]*18)
num = mp(nums)

if n>limit:
  print(-1)
else:
  print(num)

Submission status: Runtime Error

Solution code:
k=int(input())
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
    mal=mal*n[i]
    if(mal>10**18and n[i]!=0):
            mal=-1
            break
     if(n[i]==0):
        mal=0
        break
print(mal)

Submission status: Runtime Error

Solution code:
k=int(input())
mal=1      
n=list(map(int,input().split()))
      
          
for i in range(0,len(n)):
    mal=mal*n[i]
    if(mal>10**18and n[i]!=0):
            mal=-1
            break
        if(n[i]==0):
        mal=0
        break
print(mal)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

a.sort()

if a[0] == 0:
    print(0)
else:
    m = 1
    i = 0
    while m < 10**18:
        m *= a[i]
        if m > 10**18:
            print(-1)
            sys.exit()
        i += 1
        if i == n:
            print(m)

Submission status: Runtime Error

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

a.sort()

if a[0] == 0:
    print(0)
else:
    m = 1
    i = 0
    while m < 10**18:
        m *= a[i]
        if m > 10**18:
            print(-1)
            sys.exit()
        i += 1
    print(m)

Submission status: Runtime Error

Solution code:
N = int(input())
lista = [int(x) for x in input().split()]
q = 0
for i in lista:
  q *= i
  if q > 10**18:
    print(-1)
    return
 print(q)

Submission status: Runtime Error

Solution code:
a = (int(input()).replace('','*')

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

Submission status: Runtime Error

Solution code:
a = map(int, input().replace('','*')

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

Submission status: Runtime Error

Solution code:
if int(count) == 0:
  result = 0
else:
  nums_str = input().split()
  nums_int = []
  for strn in nums_str:
    nums_int.append(int(strn))
 
    result = 1

  else:
    for intn in nums_int:
      result *= intn
      if result > 10**18:
        result = -1
        break
    
print(result)

Submission status: Runtime Error

Solution code:
count = input()
nums_str = input().split()
nums_int = []
for strn in nums_str:
  nums_int.append(int(strn))

result = 1
if count == 0:
  result = 0
elif:
  for intn in nums_int:
    result *= intn
    if result > 10**18:
      result = -1
      break
    
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

k = 1
l = []

for i in range(n+1):
  k = k * a[i]
  l.append(l)

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

Submission status: Runtime Error

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

k = 1
l = []

for i in range(n+1):
  k = k * i
  l.append(l)

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

Submission status: Runtime Error

Solution code:
"""
~~ Author : Bhaskar
~~ Dated : 13~06~2020
"""

import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque

INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize) - 1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a, b: (a * b) // gcd(a, b)
setbit = lambda x: bin(x)[2:].count("1")
INT = lambda type: type(sys.stdin.readline()) if type in [int, float] else type(sys.stdin.readline()).replace("\n", "")
ARRAY = lambda type: list(map(type, sys.stdin.readline().split()))
NUMS = lambda type: map(type, sys.stdin.readline().split())


def solve():

    n = INT(int)
    a = ARRAY(int)
    if 0 in a:
        print(0)
    else:
        p = 1
        ok = False
        for i in a:
            a *= i
            if a > 10**18:
                ok = True
                break
        print(a if not ok else -1)



if __name__ == "__main__":
    try:
        sys.stdin = open("input.txt", "r")
    except:
        pass
    solve()

Submission status: Runtime Error

Solution code:
"""
~~ Author : Bhaskar
~~ Dated : 13~06~2020
"""

import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque

INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize) - 1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a, b: (a * b) // gcd(a, b)
setbit = lambda x: bin(x)[2:].count("1")
INT = lambda type: type(sys.stdin.readline()) if type in [int, float] else type(sys.stdin.readline()).replace("\n", "")
ARRAY = lambda type: list(map(type, sys.stdin.readline().split()))
NUMS = lambda type: map(type, sys.stdin.readline().split())


def solve():

    n = INT(int)
    a = ARRAY(int)
    if 0 in a:
        print(0)
        return
    p = 1
    for i in a:
        a *= i
        if a > 10**18:
            print(-1)
            return 
    print(a)



if __name__ == "__main__":
    try:
        sys.stdin = open("input.txt", "r")
    except:
        pass
    solve()

Submission status: Runtime Error

Solution code:
input()
lst = list(map(int, input().split()))
multiplier = 1
for a in lst:
  multiplier *= a
if counter > 10**18:
  print('-1')
else:
  print(multiplier)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

d=1

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

Submission status: Runtime Error

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

d=1

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

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:
      break
if d>10**18:
  print("-1")
else:
  print(d)