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: Wrong Answer

Solution code:
##169

##B
N = int(input())
A = list(map(int,input().split()))
ans = 1
i=0
if 0 in A:
  print(0)
else:
  while N > i:
    if ans <= 10**18:
        ans *= A[i]
        i += 1
    else:
        ans = -1
        break
  print(ans)

Submission status: Wrong Answer

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

limit = 10**18
ans = 1

if 0 in given_list:
    print(0)
else:
    for i in given_list:
        ans *= i
        if ans >= limit:
            print('-1')
            break
    if ans < limit:
        print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
lst = list(map(int, input().split()))
mul = np.prod(lst)
thr = 10 ** 18
if int(mul) > thr:
  print('-1')
else:
  print(mul)

Submission status: Wrong Answer

Solution code:
n = int(input())
lst = map(int, input().split())
mul = 1
thr = 10 ** 18
for ai in lst:
  mul = mul * ai
  if int(mul) > thr:
    print('-1')
    exit()
print(mul)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 0 in A :
    ans = 0

for x in range(N) :
    ans *= A[x]
    if ans > 10E+18 :
        ans = -1
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
k=input()
a=list(map(int,input().split()))
p=1
count=0
if(len(a)==0):
    print("0")
while(count<len(a)):
    p*=a[count]
    count+=1
    if(p>pow(10,18)):
        print("-1")
        break
if(p<pow(10,18)and len(a)>0):
    print(p)

Submission status: Wrong Answer

Solution code:
k=input()
a=list(map(int,input().split()))
p=1
count=0
while(count<len(a)):
    p*=a[count]
    count+=1
    if(p>pow(10,18)):
        print("-1")
        break
if(p<pow(10,18)):
    print(p)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())

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

a = 1

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

Submission status: Wrong Answer

Solution code:
a = 1

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

if 0 in s :
    print(0)
else :
    for i in range(N) :
        if a>10E+18 :
            print(-1)
            break
        else :
            a = a*s[i]
    if a>10E+18 :
        print(-1)
    else :
        print(a)

Submission status: Wrong Answer

Solution code:
num = int(input())

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

a = 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np

a = int(input())

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

a = 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np

a = int(input())

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

a = 1

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

Submission status: Wrong Answer

Solution code:
import numpy as np

a = int(input())

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

lp = np.prod(list)

print(lp if lp > 1000000000000000000 else "-1")

Submission status: Wrong Answer

Solution code:
import numpy as np

a = int(input())

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

lp = np.prod(list)

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

Submission status: Wrong Answer

Solution code:
# Multiplication 2
# https://atcoder.jp/contests/abc169/tasks/abc169_b

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

Submission status: Wrong Answer

Solution code:
# B - Multiplication 2

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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


main()

Submission status: Wrong Answer

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


main()

Submission status: Wrong Answer

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


main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if S>=10^18:
  S=-1
print(S)

Submission status: Wrong Answer

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

if S>10^18:
  S=-1
print(S)

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

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

if S>=10^18:
  S=-1
print(S)

Submission status: Wrong Answer

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

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

if S>10^18:
  S=-1
print(S)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1
nums = map(int, input().split(' '))
if 0 in nums:
    print(0)
    exit()
else:
    for i in nums:
        ans *= i
        if ans > 1000000000000000000:
            print(-1)
            exit()
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
nums = list(map(int, input().split(' ')))
ans = np.prod(nums)
if ans >= 10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
nums = list(map(int, input().split(' ')))
ans = np.prod(nums)
if ans > 10**18:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def multiply(num_list):
  # if res > 10^18: return -1
  MAX = pow(10,18)
  res = 1
  for i in num_list:
    res *= i
    if res == 0:
      return 0
    if res > MAX:
      return -1
  return res

input()
num_list = list(map(int,input().split()))
print(multiply(num_list))

Submission status: Wrong Answer

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

keta = 0
for c in range(N):
    keta += len(str(A[c])) - 1

if keta >= 22:
    print("-1")
else:
    ans = 1
    for c in range(N):
        ans *= A[c]
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)

Submission status: Wrong Answer

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

keta = 0
for c in range(N):
    keta += len(str(A[c])) - 1

if keta >= 20:
    print("-1")
else:
    ans = 1
    for c in range(N):
        ans *= A[c]
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)

Submission status: Wrong Answer

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

keta = 0
for c in range(N):
    keta += len(str(A[c])) - 1

if keta >= 19:
    print("-1")
else:
    ans = 1
    for c in range(N):
        ans *= A[c]
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)

Submission status: Wrong Answer

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

keta = 0
for c in range(N):
    keta += len(str(A[c])) - 1

if keta >= 18:
    print("-1")
else:
    ans = 1
    for c in range(N):
        ans *= A[c]
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 1
ok = True
for x in a:
  ans*=x
  if (ans>1e18):
    ok = False
    break
    
if ok:
  print(ans)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

def multi2():
    N = int(input())
    a = list(map(int,input().split()))

    m = np.prod(a)

    if(m<=1000000000000000000):
        return m
    else:
        return -1


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

Submission status: Wrong Answer

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

print(total)

Submission status: Wrong Answer

Solution code:
import sys

def main(lines):
    # このコードは標準入力と標準出力を用いたサンプルコードです。
    # このコードは好きなように編集・削除してもらって構いません。
    # ---
    # This is a sample code to use stdin and stdout.
    # Edit and remove this code as you like.

    for i, v in enumerate(lines):
        print("line[{0}]: {1}".format(i, v))
        
if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append([int(s) for s in l.rstrip('\r\n').split()])
N=lines[0][0]
l=lines[1]
K=1
for i in l:
  K=K*i
print(K)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
#import copy


def xnxn(n=0):
    """
    args:
        int n: a number of lows to read
    example:
        input   1
        retrun  1

        input   1 2 3
        return  [1,2,3]
        input   1 2 3
                4 
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        temp = list(map(int, input().split()))
        if len(temp) == 1:
            return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        temp = [list(map(int, input().split())) for _ in range(n)]
        return temp


def sp_xnxn(n=0):
    """
    args:
        int n: a number of lows to read
    example
        input   1
        retrun  [1]

        input   123
        return  [1,2,3]

        input   123
                4 
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        return [int(k) for k in xsxs()]
    else:
        return [[int(k) for k in xsxs()] for _ in range(n)]


def xsxs(n=0):
    """
    args:
        int n: a number of lows to read 
    example:
        input   AA
        retrun  AA

        input   A BBB CC
        return  ["A","BBB","CC"]

        input   A BB CCC
                D
        return  [["A","BBB","CC"],
                ["D"]]
    """
    if n == 0:
        temp = list(input().split())
        if len(temp) == 1:
            return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        return [list(input().split()) for _ in range(n)]


def sp_xsxs(n=0):
    """
    args:
        int n: a number of lows to read 
        example:
            input   A
            retrun  ["A"]

            input   ABC
            return  ["A","B","C"]

            input   ABC
                    D
            return  [["A","B","C"],
                    ["D"]]
    """
    if n == 0:
        return [s for s in xsxs()]
    else:
        return [[s for s in xsxs()] for _ in range(n)]


n = xnxn()
a = xnxn()

temp = 1
for i in range(n):
    temp = temp * a[i]
    if temp > 1e18:
        print(-1)
        sys.exit()

print(temp)

Submission status: Wrong Answer

Solution code:
n = int(input())
res = 1
q = []
qw = input()
q = qw.split()
for i in q:
	res *= int(i)
	if(res > 1000000000000000000):
		print(-1)
		break
	elif(i == n-1):
		print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
res = 1
q = []
qw = input()
for i in range(n):
	q = qw.split()
for i in q:
	res *= int(i)
	if(res > 1000000000000000000):
		print(-1)
		break
	elif(i == n-1):
		print(res)

Submission status: Wrong Answer

Solution code:
import math
#####sorting a dictionary#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
flag=[0]*1000002
def seive_primes():
    flag[0]=flag[1]=1
    i=2
    while i*i<=1000000:
        if flag[i]==0:
            j=i*i
            while j<=1000000:
                flag[j]=1
                j+=i
        i+=1
def sqr(n):
    return n*n
def inp():
    ls=list(map(int,input().split()))
    return ls
n=int(input())
ls=inp()
ans=1
for i in ls:
    ans*=i
    if ans>10e18:
        print(-1)
        exit(0)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
#####sorting a dictionary#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
flag=[0]*1000002
def seive_primes():
    flag[0]=flag[1]=1
    i=2
    while i*i<=1000000:
        if flag[i]==0:
            j=i*i
            while j<=1000000:
                flag[j]=1
                j+=i
        i+=1
def sqr(n):
    return n*n
def inp():
    ls=list(map(int,input().split()))
    return ls
ls=inp()
ans=1
for i in ls:
    ans*=i
    if ans>10e18:
        print(-1)
        exit(0)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
#####sorting a dictionary#####
def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))
flag=[0]*1000002
def seive_primes():
    flag[0]=flag[1]=1
    i=2
    while i*i<=1000000:
        if flag[i]==0:
            j=i*i
            while j<=1000000:
                flag[j]=1
                j+=i
        i+=1
def sqr(n):
    return n*n
def inp():
    ls=list(map(int,input().split()))
    return ls
ls=inp()
if math.prod(ls)>10e18:
    print(-1)
else:
    print(math.prod(ls))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

N = input()
nums = input().split()
 
if 0 in nums:
  print('0')
  sys.exit(0)

nums = [int(x) for x in nums]
res = np.prod(nums)

if res >= 1000000000000000000:
  res = -1
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
#import numpy as np

N = input()
nums = input().split()
 
if 0 in nums:
  print('0')
  sys.exit(0)

nums = [int(x) for x in nums]
#res = np.prod(nums)

res = 1
for i in nums:
  if res >= 1000000000000000000:
    res = -1
  res *= i
#if res > 1000000000000000000:
#  res = -1
print(res)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

N = input()
nums = input().split()
 
if 0 in nums:
  print('0')
  sys.exit(0)

nums = [int(x) for x in nums]
res = np.prod(nums)

if res > 1000000000000000000:
  res = -1
print(res)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

N = input()
nums = input().split()
nums = [int(x) for x in nums]
res = 1
 
if 0 in nums:
  print('0')
  sys.exit(0)

print(np.prod(nums))

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
argList = np.array(list(map(int, input().split()))) 
ret = 1
for i in argList:
    ret = ret*i
    if ret > 10**18 :
        ret = -1
        break
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
N = input()
nums = input().split()
res = int(nums.pop(0))
 
if 0 in nums:
  print('0')
  sys.exit(0)
 
for i in nums:
  res *= int(i)
 
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(pro)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
num = sorted(list(map(int, input().split())), reverse=True)
# print(num)
prod = 1
if num[-1] == 0:
  prod = 0
for i in range(N):
  if prod > 10^18:
    prod = -1
    break
  else:
    prod *= num[i]
print(prod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
if 0 in A:
  print("-1")
  exit(0)
ans = 1
lim = 10**18
for a in A:
  ans *= a
  if ans > lim:
    print("-1")
    exit(0)
print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

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

now = 1

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

print(now)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = list(map(int, input().split()))
ans = 1
for e in li:
    ans *= e
    if ans > 1e18:
        print(-1)
        exit()

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
vals = [int(v) for v in input().split()]

rslt = 1

if 0 in vals:
  rlst = 0

for v in vals:
  rslt = rslt * v
  
  if rslt > 10 ** 18:
    rslt = -1
    break

print(rslt)

Submission status: Wrong Answer

Solution code:
N = int(input())
vals = [int(v) for v in input().split()]

rslt = 1

for v in vals:
  rslt = rslt * v
  
  if rslt > 10 ** 18:
    rslt = -1
    break
    
print(rslt)

Submission status: Wrong Answer

Solution code:
n = input()

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

x = num_list[0]

for i in num_list[1:len(num_list)]:
  if i == 0:
    print("0")
    x = 0
    break
  x *= i
  
  if x > 10 ** 18:
    print("-1")
    break

if x == 0:
  pass
elif x < 10 ** 18:
  print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()

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

x = num_list[0]

for i in num_list[1:len(num_list)]:
  if 0 in num_list:
    print("0")
    x = 0
    break
  x *= i
  
  if x > 10 ** 18:
    print("-1")
    break

if x == 0:
  pass
else:
  print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()

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

x = num_list[0]

for i in num_list[1:len(num_list)]:
  x *= i
  
  if x > 10 ** 18:
    print("-1")
    break

if x < 10 ** 18:
  print(x)

Submission status: Wrong Answer

Solution code:


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

ans = 1

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
totalNumbers=int(input())
array=list(map(int,input().split()))
import math
print(math.prod(array))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a_L = list(map(int,input().split()))
a_L = sorted(a_L)
           
if a_L[0] == 0:
  print(0)
  exit()
 
ans = 1
 
for i in range(len(a_L)):
  ans = ans*a_L[i]
  if ans > 10**8:
    print(-1)
    exit()
print(ans)