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())
sum = 1
for i in range(N):
  a = int(input())
  sum = sum * a
print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

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

for i in a:
    ans *= i

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

print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int,input().split()))
X=1
if 0 in A:
  print(0)
  break

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

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int,input().split()))
X=1
if 0 in A:
  print(0)
  return

for idx in range(N):
  X=X*A[idx]
  if X >1*10**18:
    print(-1)
    return

print(X)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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


prod = 1
for a in A:
  if a == 0:
    prod = 0
  prod *= a
  if prod > 1000000000000000000:
  prod = -1

print(prod)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from decimal import *

A, B = input().split()
a = int(A)
b = Decimal(B)
ib = int(100*b)


print(int((a*ib)/100))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N=int(input())
L=list(map(int,input().split()))
A=1
for i in range(N):
  A=A*L[i]
  if 10**18&lt;A:
    print(-1)
    exit()
print(A)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if ans > max_limit:
  print(str(-1))
else:
  print(str(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
arr = list(map(int,intput().split()))
if 0 in arr:
	print(0)
else:
	sum = 1
	for x in arr:
		sum = sum*x
		if(sum > 1e+18):
			print(-1)
		else:
			print(sum)

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
    break

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().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:
input();a=sorted(map(int,input().split()));z=1
for i in a:
 if i>1e18//z:z=-1;break
 z*=i
print(z)

Submission status: Runtime Error

Solution code:
input();a=eval(input().replace(' ','*'));print((a,-1)[a>1e18])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = A[0]

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A,B=[0]*n,[0]*n
    for i in range(n):
        A[i],B[i]=map(int,input().split())
    A.sort()
    B.sort()
    if n%2==1:
        print(B[n//2]-A[n//2]+1)
    else:
        print(int(((B[n//2-1]+B[n//2])/2-(A[n//2-1]+A[n//2])/2)*2)+1)

if __name__=='__main__':
    main()

Submission status: Runtime Error

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
    break
if 0 in a:
  s = 0
print(s)

Submission status: Runtime Error

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
    break
if 0 in n:
  s = 0
print(s)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
nums = map(int,input().split())
num = 10**18
count = 1
for i in range(n):
	count *= nums[i]

if count < num:
	print(-1)
else:
	print(count)

Submission status: Runtime Error

Solution code:
=int(input())
A=list(map(int,input().split()))
x=1
flag=0
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    flag=1
    exit()
  else:
    continue

if flag==0:
  print(x)

Submission status: Runtime Error

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

print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def prod(li):
  pd = 1
  for l in li:
    pd *= li
  return pd

if __name__ == '__main__':
  n = input()
  a = [int(x) for x in input().split()]
  prd = prod(a)
  if prd > int(1e+18):
    print(-1)
  else:
    print(prd)

Submission status: Runtime Error

Solution code:
def prod(li):
  if li == []:
    return 1
  return li[0] * prod(li[1:])

if __name__ == '__main__':
  n = input()
  a = [int(x) for x in input().split()]
  prd = prod(a)
  if prd > int(1e+18):
    print(-1)
  else:
    print(prd)

Submission status: Runtime Error

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

if 0 in a:
    print(0)
else:

    ans = 1
    i = 0
    while (ans < 10 ** 18):
        ans *= a[i]
        i += 1

    if i == n - 1:
        print(ans)
    else:
        print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
ans =1
A = list(map(int,input().split()))
for i in A:
        if i =0:

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

Submission status: Runtime Error

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

kMax = 10**18

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

for i in map(int, input().split()):
    ans *= i
    if ans > kMax:
        print(-1)
        exit()
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input)
s=list(map(input().split()))
ans=1
for i in s:
  ans*=i
  if ans>10e18:
    print('-1')
    break
print(ans)

Submission status: Runtime Error

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

product = 1
for x in v:
  if x == 0:
    print(0)
    return
  product *=  x
  
if product > 1000000000000000000:
  print(-1)
else:
  print(product)

Submission status: Runtime Error

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

product = 1
for x in v:
  if x == 0:
    print(0)
    return
  product *=  x
  
if product > 1000000000000000000:
  print(-1)
else:
  print(product)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
arr = str(input())
lst =[]
for i in arr.split():
    lst.append(i)
multi = 1
lst = lst.sort()
temp = pow(10,18)
for i in lst:
    if int(i) > temp:
        print(-1)
        exit(0)
    else: multi *= int(i)
print(multi)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
arr = str(input())
lst =[]
for i in arr.split():
    lst.append(i)
multi = 1
for i in lst:
    if i > pow(10,18):
        print(-1)
        exit(0)
    else: multi *= int(i)
print(multi)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = eval(input().replace(' ','*'))
print(sum if sum<= 10**18 else -1)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = eval(input().replace(' ','*'))
print(sum if sum<= 10**8 else -1)

Submission status: Runtime Error

Solution code:
input();a=eval(input().replace(' ','*'));print((a,-1)[a>10**18])

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){



// }
     int linf = 1e18;
  	int n;
  	cin >> n;
  	int arr[n];
  	fo(i,0,n)cin >> arr[i];
  	sort(arr,arr+n);
  	uint64_t res = 1;
  	int flag = 1;
  	fo(i,0,n){
  		if(res*arr[i] > linf){
  			flag = 0;
  			break;
  		}
  		res = res*arr[i];
  	}
  	if(flag)cout << res << endl;
  	else cout << -1 << endl;


return 0;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
//     int t;
//      cin >> t;

//      while(t--){



// }
     uint64_t linf = 1e18;
  	int n;
  	cin >> n;
  	int arr[n];
  	fo(i,0,n)cin >> arr[i];
  	sort(arr,arr+n);
  	uint64_t res = 1;
  	int flag = 1;
  	fo(i,0,n){
  		if(res*arr[i] > linf){
  			flag = 0;
  			break;
  		}
  		res = res*arr[i];
  	}
  	if(flag)cout << res << endl;
  	else cout << -1 << endl;


return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

A = sorted(A)
result = 1
max = 10**18
for a in A:
    result *= a
    if result > max:
        print(-1)
        break
    else:
        print(result)

Submission status: Runtime Error

Solution code:
101 9901 999999000001

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll result = 1;
    for(int i=0;i<N;i++) {
        cin >> A.at(i);
    }

    if(find(A.begin(),A.end(),0) != A.end()) {
        cout << "0" << endl;
        exit(0);
    }
    for(int i=0;i<N;i++) {
        result = result * A.at(i);
        if (result > (ll)pow(10,18)) {
            cout << "-1" << endl;
            exit(0);
        }
    }
    cout << result << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = 1

ok = True
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        ok = False
        break

for i in range(N):
    if a[i] == 0:
        ok = True
        ans = 0

if ok == True:
    print(ans)
else:
    print(-1)

Submission status: Runtime Error

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

if 0 in A:
  iszero = True

for i in range(N):
  if(iszero):
    ans = 0
    break
    
  ans *= A[i]
  
  if(ans>10**18):
    ans = -1

print(ans

Submission status: Runtime Error

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

for 0 in range A:
  if(A[i]==0):
    iszero = True

for i in range(N):
  if(iszero):
    ans = 0
    break
    
  ans *= A[i]
  
  if(ans>10**18):
    ans = -1

print(ans)

Submission status: Runtime Error

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

for 0 in range A:
  if(A[i]==0):
    iszero = True

for i in range(N):
  if(iszero):
    ans = 0
    break
    
  ans *= A[i]
  
  if(ans>10**18):
    ans = -1

print(ans

Submission status: Runtime Error

Solution code:
N, A = map(int, open(0).read().split())
if 0 in A:
    print(0)
    exit()
ans = 1
for a in A:
    ans *= a
    if ans > 10 ** 18:
        print(-1)
        break
else:
    print(ans)

Submission status: Runtime Error

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

    if 0 in A:
        print(0)
        return

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

    print(prod)

main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
for i in range(0,n):
    a*=int(input())
    if(a>10**18):
        a=-1
if(a<0):
    a=-1
print(a)

Submission status: Runtime Error

Solution code:
N = int(input())
i = 0
ans = 1
for i < 0:
    a = int(input())
    ans = ans*a
    i = i+1
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if 0 in A:
    print(0)
    return

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

    print(SUM)

main()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = map(int,input().split())
a.sort()
t = 1
 
for i in range(len(a)):
  t *= a[i]
  if t > 10**18:
    break

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

Submission status: Runtime Error

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

for i in a:
  t *= i

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

Submission status: Runtime Error

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

for i in a:
  t *= a[i]

print(str(t))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1
for i in range(0, n):
  b = int(input())
  ans *= b
if a > 10**18:
   print(-1)
else:
  print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

def multi_lst(lst):
    ans = lst[0]
    for i in range(1, len(lst)):
        ans *= lst[i]
    
    return ans
if a.index(0):
    print(0)
    exit()
else:
    ans = multi_lst(a)

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

Submission status: Runtime Error

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

def multi_lst(lst):
    ans = lst[0]
    for i in range(1, len(lst)):
        ans *= lst[i]
    
    return ans
if a.index(0):
    print(0)
else:
    ans = multi_lst(a)
    
if ans <= 10**18:
    print(ans)
else:
    print('-1')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy
N = input()
An = input().split()
AnS = numpy.prod(An)
print(AnS)

Submission status: Runtime Error

Solution code:
from decimal import*
n = int(input())
a = input().split(" ")
kotae=Decimal(1)
lista = [int(n) for n in a]
for i in range(n):
  kotae*=Decimal(lista[i])
if kotae>10**18:
  kotae=-1
print(int(kotae))

Submission status: Runtime Error

Solution code:
from decimal import*
n = int(input())
a = input().split(" ")
kotae=Decimal(1)
lista = [int(n) for n in a]
for i in range(n):
  kotae*=Decimal(lista[i])
if kotae>10**18:
  kotae=-1
print(kotae)

Submission status: Runtime Error

Solution code:
from decimal import
n = int(input())
a = input().split(" ")
kotae=Decimal(1)
lista = [int(n) for n in a]
for i in range(n):
  kotae*=Decimal(lista[i])
if kotae>10**18:
  kotae=-1
print(kotae)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
using System;
using System.Linq;
class program{
  static void Main(){
    int n = int.Parse(Console.ReadLine());
    long[] a = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long ans = 1;
    a.Sort();
    if(a[0] == 0){
      Console.Write(0);
      return;
    }
    for(int i = 0;i<n;i++){
      if(ans*a[i] > 1e18){
        Console.Write(-1);
      	return;
      }
      ans *= a[i];
    }
    Console.Write(ans);
  }
}

Submission status: Runtime Error

Solution code:
length = 1
limit = 10 ** 18
for i in range(N):
    length = length *  A[i]
    if length > limit:
        print('-1')
        break
    if i == N-1:
        print(length)

Submission status: Runtime Error

Solution code:
x=int(input())
b=input()
lst=b.split(" ")
a=0
ans=int(lst[0])
q=0
while(a<x-1):
    q=int(lst[a+1])
    ans*=q
    a+=1
if(ans<10**18)
    print(ans)
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:
    ans = 1
    for i in A:
        ans *= i
if ans >10**18:
        print(-1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
def Qb():
    from functools import reduce
    from operator import mul

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

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

    ans = reduce(mul, lina)

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


def Qc():
    pass


if __name__ == '__main__':
    Qb()

Submission status: Runtime Error

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

print(total)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

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

ans = np.prod(A)
if ans<= 10**18:
    print(ans)
    sus.exit()
if 10**18 < ans:
    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 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
if 0 in A:
    print(0)
    exit(0)
    
ans = np.prod(A)
if ans<= 10**18:
    print(ans)
    exit(0)
if 10**18 < ans:
    print(-1)

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)
if ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)