Problem:


Score : 200 points

Problem Statement

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

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

Constraints

2 \leq N \leq 10^5

0 \leq A_i \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 ... A_N

Output

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

Sample Input 1

2
1000000000 1000000000

Sample Output 1

1000000000000000000

We have 1000000000 \times 1000000000 = 1000000000000000000.

Sample Input 2

3
101 9901 999999000001

Sample Output 2

-1

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

Sample Input 3

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

Sample Output 3

0



Sample input:
2
1000000000 1000000000


Sample output:
1000000000000000000

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
import numpy as np
if 0 in A:
    print(0)
    exit(0)
    
ans = np.prod(A)
elif ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
import numpy as np
ans = np.prod(A)

if 0 in A:
    print(0)
    exit(0)
elif ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
import numpy as np
ans = np.prod(A)

if 0 in A:
    print(0)
    exit(0)
if ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
import numpy as np
ans = np.prod(A)

if 0 in A:
    print(ans)
    exit(0)
if ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 1
import numpy as np
ans = np.prod(A)

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
A = list(map(int, input().split()))
A.sort(reversed=True)
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print(-1)
    sys.exit()
print(res)

Submission status: Runtime Error

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
n=int(input())
A=input_array()
MAX=10**18
ans=A[0]

for i in range(1,len(A)):
	ans*=A[i]
	if ans==0:
		break
	elif ans>MAX:
		ans=-1
		break
	else:
		pass

print(ans)

Submission status: Runtime Error

Solution code:
import itertools
import operator

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

if 0 in ms:
  r = 0
else:
  r = itertools.reduce(operator.mul, li)
if r > 10 ** 18:
  r = -1
print(r)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(lambda a : int(a), input().split(" ")))
ans = 1
print i in range(len(A)):
  ans *= A[i]

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())

list1 = list(map(int, input().split(" ")))

def calc():
    result = 1
    if 0 in result:
        print("-1")
        exit()
    for i in list1:
        result *= i
        if result > 1000000000000000000:
            print("-1")
            exit()
    print(result)

calc()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

ans = 1

if 0 in A:
  ans = 0
else:
  for i in A:
    ans *= A
    i += 1
    if ans > 10**18:
      ans = -1
      break

print(ans)

Submission status: Runtime Error

Solution code:
kazu = int(input())
word = input()
score = word.split()
scin = [0]*kazu
zero = 0
for i in range(kazu):
    scin[i] = int(score[i])
    if scin[i] == 0:
        zero = 1:

answer = 1
for j in range(kazu):
    answer *= scin[j]
    if answer > 10**18 and zero == 0:
        answer = -1

if zero == 1 and answer > 10**18:
    answer = -1

print(answer)

Submission status: Runtime Error

Solution code:
n = int(input())

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

count = 1

for i in a:
    count*=i

x = 10**18

if count > x:
    print(-1)
    break
else:
    print(count)

Submission status: Runtime Error

Solution code:
n = int(input())

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

count = 1

for i in a:
    count*=i

x = 10**18

if count > x:
    print(-1)
    break
else:
    print(count)

Submission status: Runtime Error

Solution code:
import sys

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

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

hg = 10 ** 18
ans = 1
for i in a:
    ans *= i
    if ans > hg:
        print(-1)
        sys.exit()

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author apurba_debnath
 */

#include <bits/stdc++.h>

#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl

using namespace std;

class BMultiplication2 {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        ll a[101010];
        ll zero = 0;
        for (int i = 0; i < n; ++i) {
            in >> a[i];
            if (a[i] == 0)
                zero++;
        }
        if (zero)
            out << 0;
        else {
            ll p = 1;
            for (int i = 0; i < n; ++i) {
                if (a[i] <= 1e18 / p)
                    p *= a[i];
                else {
                    out << "-1";
                    return;
                }
            }
            out << p;
        }
    }
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    BMultiplication2 solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);

    return 0;
}

Submission status: Runtime Error

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

lim = 1
for i in range(18):
    lim *= 10

ans = 1

for A_ in A:
    ans *= A
    if ans > lim:
        ans = -1
        break

print(ans)

Submission status: Runtime Error

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

ans = 1

for i in as:
    ans *= i
    ans = min(ans, 10**18+1)

if ans == 10**18+1:
    print(-1)

print(ans)

Submission status: Runtime Error

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

ans = 1

for i in as:
    ans *= i
    ans = min(ans, 10*18+1)
if ans == 10**18+1:
    print('-1')
    break

print(ans)

Submission status: Runtime Error

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

ans = 1

for i in as:
    ans *= i

ans = min(ans, 10*18+1)
if ans == 10**18+1:
    print('-1')\
    break

print(ans)

Submission status: Runtime Error

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

ans = 1

for i in as:
    ans *= i
    ans = min(ans, 10*18+1)
    if ans == 10**18+1:
        print('-1')

else:
    print(ans)

Submission status: Runtime Error

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

ans = 1

for i in as:
    ans *= i
    ans = min(i, 10*18+1)
    if ans == 10**18+1:
        print('-1')

else:
    print(ans)

Submission status: Runtime Error

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

ans = 1

for i in as:
    ans *= i
    ans = min(i, 10*18+1)
    if ans <= 10**18+1:
        print(-1)

else:
    print(ans)

Submission status: Runtime Error

Solution code:
from sympy import prime
import numpy as np

N = int(input())
A = list(map(int, input().split()))
ans = np.prod(A)
if ans <= 10 ** 18:
    print(ans)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long k, s=1,a,b;

    cin>>a;
    for(int i=0; i<a; i++){
        cin>>k;
        s*=k;
    }
    
    if(s/10000000000000000<-1) puts("-1");
    else if(s>1000000000000000000)
    cout<<s;

}

Submission status: Runtime Error

Solution code:
p = list(map(int(input().split))
s = 1
for i in p:
         s*=i
if(s>1000000000000000000):
         print(-1)
else:
         print(s)

Submission status: Runtime Error

Solution code:
N=int(input())
data=list(map(int,input().split()))
s=1
for 0 in data:
    print(0)
    end()
for d in data:
    s *= d
if s > 10**18:
    print(-1)
else:
    print(s)

Submission status: Runtime Error

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

def main():

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

    ans = 1

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
from decimal import Decimal
# input
n = int(input())
a = list(map(int, input().split()))
out = 1
if 0 in a:
    print(0)
    quit()
for i in range(n):
    out = Decimal(out * a[i])
    if out > Decimal(10**18):
        print(-1)
print(out)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
from decimal import Decimal
# input
n = int(input())
a = list(map(int, input().split()))
out = 1
for i in range(n):
    out = Decimal(out * a[i])
    if out.conut(0) > 0:
        print(out)
        quit()
    elif out > Decimal(10**18):
        print(-1)
        quit()
print(out)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

solve()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
arr = list(map(int, input().split()))
if 0 in arr:
    print(0 + '\n')
else:
    mul = 1
    for n in arr:
        mul *= n
        if mul > 10**18:
            print(-1 + '\n')
            break
    else:
        print(mul + '\n')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
    n=int(input())
    I=list(map(int,input().split()))
    num=1
    if 0 in I:
        prtin("0")
        return
    for i in I:
        num*=i
        if num>10*18:
            print("-1")
            return
    print()
main()

Submission status: Runtime Error

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

if 0 in nums:
    print(0)
    exit 0

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

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

Submission status: Runtime Error

Solution code:
n=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
X=1
while X<=10**18:
  for i in range(N):
    X*=A[i]
if X<=10**18:
  print(X)
else:
  print(-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

n=int(input())
A=np.ndarray(map(int,input().split()))
a=np.prod(A)
if a>10**18:
    print("-1")
else:
    print(a)

Submission status: Runtime Error

Solution code:
n=int(intput())
arr=list(input().slpit())
arr.sort();
x=int(1)
for i in arr:
  x=x*i
  if x>1e18:
    x=-1;
    break;
print(x)

Submission status: Runtime Error

Solution code:
N = int(input())
mul1 = 1
 
for i in range(N):
    mul1 = mul1 * int(input())
    if mul1 > 10^18 :
        print(-1)
        break
else:
  print(mul1)

Submission status: Runtime Error

Solution code:
N = int(input())
mul1 = 1

for i in range(N):
	mul1 = mul1 * int(input())
    if mul1 > 10^18 :
      print(-1)
      break
else:
  print(mul1)

Submission status: Runtime Error

Solution code:
a,b = map(float,input().split())
print(int(a*b))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if 0 in a:
  print(0)
  break

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

else:
print(ans)

Submission status: Runtime Error

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

if 0 in a:
  print(0)
  break

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

print(ans)

Submission status: Runtime Error

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

if 0 in a:
  print(0)
  break

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

print(ans)

Submission status: Runtime Error

Solution code:
    c = int(input())
    a = map(int, input().split())
    b = 1
    for x in a:
        b *= x
    if b > 1000000000000000000:
        b = -1
    print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if a.count(0) != 0:
    print(0)
else:
    result = 1
    for i in range(n):
        result *= a[i]
        if result > (10**18):
            print(-1)
            break
        else:
            continue

print(result)

Submission status: Runtime Error

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

if a.count(0) != 0:
    print(0)
else:
    result = 1
    for i in range(N):
        result *= A[i]
        if result > (10**18):
            print(-1)
            break
        else:
            continue
    else:
        print(result)

Submission status: Runtime Error

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

if a.count(0) != 0:
    print(0)
else:
    result = 1
    for i in range(N):
        result *= A[i]
        if result > (10**18):
            print(-1)
            break
        else:
            continue
print(result)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;
int n;
int numbers[110];
int result;
int main() {
  cin >> n;
  for(int i; i<n; i++){
    cin >> numbers[i]
  }
  for(int i; i<sizeof(numbers)/sizeof(array[0]); i++){
    if(i == 0){
      cout << "0";
    }else{
      result *= numbers[i]
    }
  }
  if(result > pow(10,18.0)){
    cout << "-1"
  }else{
    cout << result
  }
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
result = 1
while result <= 10^(18):
  result *= a[i]
else:
  print(-1)
    
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

A.sort()
ans=1
for i in A:
    ans *= i
    if(ans > (10 ** 18)):
        print(-1)
        sys.exit()
print(ans)

Submission status: Runtime Error

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

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

s = 1
for x in a:
  s *= x
  if s > 1000000000000000000:
    break
if s > 1000000000000000000:
  print(-1)
else:
  print(s)

Submission status: Runtime Error

Solution code:
N = int(input())
m,k = input().split()
result=int(m)*int(k)
print("%d"%result)
if result>=10**18:
    print("-1")

Submission status: Runtime Error

Solution code:
def b169(n, alist):

    ans = 1
    for i in alist:
        ans *= i

    return ans if ans < 10**18 else -1

def main():
    n = int(input())
    alist = list(int(input()))
    print(b169(n, alist))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(n):
    al_p *= al[i]
    if al_p > 10**18:
        print(-1)
        return
        
print(al_p)

Submission status: Runtime Error

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

for i in range(n):
    al_p *= al[i]
    if al_p > 10*18:
        print(-1)
        return
        
print(al_p)

Submission status: Runtime Error

Solution code:
ans = 1
ok = True
_n = int(input())
a = list(map(int,input().split()))
for i in a:
    ans *= i

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

Submission status: Runtime Error

Solution code:
N = int(input())

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



for ai in A:
  if ai == 0 :
    print('0')
    exit()
	    
ans = A[0]
border = 18 ** 10
      
for i in range(1,N):
  
  ansCp = ans
  ansCnt = 1
  while ansCp >= 10:
    ansCp /= 10
    ansCnt += 1
    
  if ansCnt == 18 and ansCp > 0:
    print("-1")
    exit()
    
  ans *= A[i]
  
      
print(str(ans))

Submission status: Runtime Error

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

ans=1
if 0 in X:
    print(0)
else:
    X.sorted(reverse = True)
    for i in range(N):
        ans *= X[i]
        if 10**18<ans:
            print(-1)
            break
    else:
        print(ans)

Submission status: Runtime Error

Solution code:
_=input()
X=int(eval(input().replace(*' *')))
print(X if X <= 1e18 else -1)

Submission status: Runtime Error

Solution code:
_=input()
X=int(eval(input().replace(*' *')))
print(X if X=<1e18 else -1)

Submission status: Runtime Error

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

if 0 in a:
  print(0)
else:
  prod = 1
  bool over = False
  for x in a:
    prod*=x
    if prod > 1000000000000000000:
      print(-1)
      over = True
      break
    if over==False:
      print(prod)

Submission status: Runtime Error

Solution code:
_=input()
X=eval(input().replace(*' *'))
print(X if X<10**18 else -1)

Submission status: Runtime Error

Solution code:
_=input()
X=eval(input().replace(*' *'))
print(X if X<= 10**18 else -1)

Submission status: Runtime Error

Solution code:
A, B = input().split()
A = int(A)
fb = float(B)
B100 = int(fb * 100)
ans = A * B100
print(int(ans/100))

Submission status: Runtime Error

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

#print(a)

ans = int(a[0])
for i in range(1,N):
    if ans > 10**18:
        break
    else:
        ans = ans * int(a[i])
if 0 in a:
    print(0)
elif:if ans > 10**18:
    print(-1)
else:
    print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if any [x == 0 for x in numbers]:
  print(0)
else:
  t = numbers [0]
  for el in numbers:
  	while total < 10**18:
    	t *= el 
  	if t < 10**18:
    	print(t)
    else:
      print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

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

ans = 1

for i in l:
  a *= i
  if a > 1000000000000000000:
    print(-1)
    sys.exit()
print(ans)

Submission status: Runtime Error

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

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

prod = 1
for i in range(len(A)):
    prod *= A[i]
    if prod > 10 ** 18:
        print(-1)
        exit()

print(prod)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]
if 0 in a:
  total = 0
else:
  total=1
  for i in a:
    total *= i
    if total > 10**8:
      total = -1
      break
print(total)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
ans = 1
for i in range(N):
    ans *= A[i]
    if ans >> 10**18:
        flg = False
        break
if flg == False:
    print(-1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
num_list = 0
for i in range(N):
  a = int(input())
  num_list.append(a)
if 0 in num_list:
  print(0)
else:
  mul = 1
  for a in num_list:
    mul *= a
    if mul > 10**18:
      print(-1)
      sys.exit()
  print(mul)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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:
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:
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())
A = [int(x) for x in input().split()]

if 0 in A:
    print(0)
    return

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

print(prod)

Submission status: Runtime Error

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

a=1
b=False
for i in range(N):
    a=a*A[i]
    if a>10^18:
        b=True
        continue

if b==False:
    print(a)
else:
    print(-1)

Submission status: Runtime Error

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

a=1
b=False
for i in range(N):
    a=a*A[i]
    if a>10^18:
        b=True
        continue

if b==False:
    print(a)
else:
    print(-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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())
ans = 1
for i in range(n):
  a = int(input())
  ans *= a
if (a > 1000000000000000000):
  print(-1)
else:
  print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())

for i in range(N):
  ans*=int(input())
  if ans>10**18:
    break
    print(-1)

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  A = list(map(int,input()))
  
  if 0 in A:
    print(0)
    return
  
  prod = 1
  for a in A:
    prod *= a
    if prod > 10**18:
      print(-1)
      return
    
    print(prod)

main()

Submission status: Runtime Error

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)
  break
  
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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 =ans*a[i]
    if ans > 10**18:
        ans=-1
         break  
print(ans)