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

Solution (Python):
import copy

def main():
    n = int(input())
    a = list( map( int, input().split()))
    sum = 1
    if 0 in a:
        print(0)
    else:
        for i in a:
            sum = sum * i
            if sum > 1000000000000000000:
                print(-1)
                exit()
        print(sum)
    
if __name__ == '__main__':
    main()

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


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

print(int(sum))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
judge = True
ans = 1
for i in a:
    ans *= i
    if (ans > 1000000000000000000):
        judge = False
        break

if judge:
    print(ans)
else:
    print(-1)

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

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


if 0 in a:
    print(0)
else:
    ans=1
    i=0
    while ans<=10**18 and i<n:
        ans*=a[i]
        i+=1

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

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

Solution (Python):
import sys 
n = int(input())
arr = input()
ans = 1
arr = list(map(int,arr.split(' ')))
arr.sort()
for i in range(n):
    t = arr[i]
    ans *= t
    if (ans > 1000000000000000000):
        print(-1)
        sys.exit()
print(ans)

Solution (Python):
N = int(input())
As = list(map(int,input().split()))
ans = 1
if 0 in As:
    print(0)
    exit(0)
for i in range(N):
    ans*=As[i]
    if ans > 1000000000000000000:
        print("-1")
        exit(0)
print(ans)

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

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

x=a[0]

if 0 not in a:
    for i in range (1,n):
        x=x*a[i]
        if x > pow(10,18):
            print(-1)
            exit()           
    print(x)         
else:
    print(0)

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

Solution (Python):
N = int(input())
a = 1
L = list(map(int, input().split()))
L.sort()
for i in L:
    a *= i
    if (a > 1e18):
        break

print(-1 if a > 1e18 else a)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
if a.count(0)!=0:
    print(0)
    exit()

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

Solution (Python):

n = map(int, input())
data = list(map(int, input().split()))
INF = 1e18
ans = 1

for d in data:
  ans = ans * d
  if ans > INF:
    ans = -1
    break

if 0 in data:
  ans = 0

print(ans)

Solution (Python):



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

for i in range(n):
  if a[i] == 0:
      ans = 0




print(ans)

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy


def main():
    n = int(input())
    a_list = tuple(map(int, input().split()))
    num = 1e18
    ans = 1
    if (0 in a_list):
        print(0)
        sys.exit()
    for i in range(n):
        ans *= a_list[i]
        if ans > num:
            print(-1)
            sys.exit()

    
    if ans <= num:
        print(ans)
    else:
        print(-1)

if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
import numpy as np

N = int(input())

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

sum = a[0]


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

for i in range(1, N):
    sum = sum * a[i]
    if sum > 10**18:
        print('-1')
        exit()

print(sum)

Solution (Python):
n = int(input())
l = [int(x) for x in input().split()]

if 0 in l:
    r=0
else:
    r = 1
    for x in range(n):
        r = r * l[x]
        if r > 10**18:
            r=-1
            break
  
print(r)

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

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

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

Solution (Python):
import sys
N = int(input())
A_list = list(map(int,input().split()))
border = 10**18

if 0 in A_list:
  print(0)
  sys.exit()
else:
  A_list.sort(reverse=True)
  pro = 1
  for i in range(N):
    pro *= A_list[i]
    if pro > 10**18:
      print('-1')
      sys.exit()
    else:
      pass

print(pro)

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

Solution (Python):

import math
import sys

def main():
    n = int(input())
    a = sorted(input_list())
    max_n = 10 ** 18
    ans = 1
    for v in a:
        ans *= v
        if ans > max_n:
            ans = -1
            break
        if ans == 0:
            break
    print(ans)


def yogen(a, b, angle):
    coss = math.cos((angle/180)*math.pi)
    return math.sqrt(a**2 + b**2 - 2*a*b*coss)


def get_angle(hour, minute):
    h = (hour * 360) / 12 + (minute * 360) / (12 * 60)
    m = (minute * 360) / 60
    angle = abs(h-m)
    return min(angle, 360-angle)

def has(v, l):
    for vl in l:
        if v == vl:
            return True
    return False

def input_list():
    return list(map(int, sys.stdin.readline().split()))


if __name__ == '__main__':
    main()

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

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
m=1
maxx=10**18
flag=0
for i in range(n):
   if l[i]==0:
       print(0)
       flag=1
       break
if flag!=1:
    flag=0
    for i in range(n):
        m*=l[i]
        if m>maxx:
            print(-1)
            flag=1
            break

    if flag!=1:
        print(m)

Solution (Python):
n = int(input())
l = [int(x) for x in input().split()]

if 0 in l:
    r=0
else:
    r = 1
    for x in range(n):
        r = r * l[x]
        if r > 10**18:
            r=-1
            break
  
print(r)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
inf=10**18
res = 1
for val in a:
    res = res*val
    if res > inf:
        res = -1
        break
if 0 in a:
    res = 0
print(res)

Solution (Python):
import sys
input = sys.stdin.readline

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

ans = 1
max = 10**18
if 0 in N:
  print(0)
else:
  for i in range(len(N)):
    ans = ans * N[i]
    if ans > max:
      ans = -1
      break
  print(ans)

Solution (Python):
import sys
n = input()
list_num =list(map(int,input().split()))
output = 1
if 0 in list_num:
    print(0)
    sys.exit()
for i in list_num:
    output = output * i
    if output > 10 ** 18:
        print(-1)
        sys.exit()
print(output)

Solution (Python):
n = int(input())

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

if l[0] == 0:
  print(0)
  exit()
res = 1

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()

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

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

def ans(a):
    if 0 in a:
        return 0
    n = 1
    for i in a:
        n *= i
        if n > 10**18:
            return -1
    return n

print(ans(a))

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

ans = 1
t = 1e18
if 0 in a:
    print(0)
    exit(0)

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

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
res = 1
A.sort()
for i in range(N):
    res *= A[i]
    if res > (10 ** 18):
        print(-1)
        exit()
    elif res == 0:
        print(0)
        exit()
print(res)

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

Solution (Python):
_,a=open(0)
t=1
for b in sorted(a.split()):
 t*=int(b)
 if t>1e18:t=-1;break
print(t)

Solution (Python):
n = int(input())
A = [*map(int,input().split())]
A.sort()
ans = 1
for a in A:
    if a == 0:
        ans = 0
        break
    ans *= a
    if ans > 10**18:
        ans = -1
        break
print(ans)

Solution (Python):
import sys
N=int(input())
A=[int(i) for i in input().split()]
p=1
for i in A:
  if i==0:
    print(0)
    sys.exit()
for i in A:
  p=p*i
  if p>1000000000000000000:
    print(-1)
    sys.exit()
print(p)

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

Solution (Python):
_=input()
A=sorted(list(map(int,input().split())))
B=1
for a in A:
    B*=a
    if B>10**18:
        B=-1
        break
print(B)

Solution (Python):
import sys
n = input()
list_num =list(map(int,input().split()))
output = 1
if 0 in list_num:
    print(0)
    sys.exit()
for i in list_num:
    output = output * i
    if output > 10 ** 18:
        print(-1)
        sys.exit()
print(output)

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
result = 1
for i in range(len(a)):
  result = result*a[i]
  if result == 0:
    break
  elif result > 1000000000000000000:
    break

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)

Solution (Python):
def main():
    _ = input()
    lst = list(map(int, input().split()))
    ans = 1

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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
over_value = 10 ** 18
total = 1
cnt = 0
while cnt < N:
    total *= A[cnt]
    if total > over_value:
        total = -1
        break
    cnt += 1
    
for i in range(N):
    if A[i] == 0:
        total = 0
print(total)

Solution (Python):

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

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
a = 1
for i in range(n):
  if l[i] == 0:
    a = 0
if a != 0:
  for i in range(n):
    a *= l[i]
    if a > 1000000000000000000:
      a = -1
      break
print(a)

Solution (Python):
def main():
  n = int(input())
  A = input()
  v = 1;
  for a in A.split(' '):
      d = int(a)
      if d == 0:
          print(0)
          return

  for a in A.split(' '):
      d = int(a)
      v *= d
      if (v > 1e18):
          print(-1)
          return
  print(v)

main()

Solution (Python):
import sys
def main():

    n=int(input())
    p=list(map(int,input().split()))
    s=1
    p=sorted(p)
    for i in p:
        s*=i
        if i==0:
            print(0)
            sys.exit()
        elif s>=10**18+1:
            print(-1)
            sys.exit()
    print(s)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
mult = 1
for i in range(n):
    mult *= a[i]
    if mult > 1e+18:
        mult = -1
        break
        
for i in range(n):
    if a[i] == 0:
        mult = 0

print(mult)

Solution (Python):
import sys
input = sys.stdin.readline

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

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

for i in range(n):
    if a[i] == 0:
        b = 0

print(b)

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

Solution (Python):
import sys

def main():
  N = int(input())
  P = sys.stdin.readline().rstrip().split()
  if '0' in P:
    print(0)
    return
  ans = 1
  for a in P:
    ans *= int(a)
    if ans > 1000000000000000000:
      print(-1)
      return
  print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 1
a.sort()
if a[0] == 0:
    ans = 0
    print(ans)
    exit()

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

print(ans)

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

ans = 1

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

Solution (Python):
import numpy as np
import sys
input = sys.stdin.readline
 
n = int(input())
a = list(map(int,input().split()))
ans = 1

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

print(ans)

Solution (Python):

N = int(input()) 
A = list(map(int, input().split()))
S = set(A)
if 0 in S:
  print(0)
  exit()
 
upp = 10**18
ans = 1

for a in A:
  ans *= a
  if ans > upp:
    ans = -1
    break
 
print(ans)

Solution (Python):
def ans(lst):
  if 0 in lst:
    return 0
  n = 1
  for i in lst:
    n *= i
    if n > 10**18:
      return -1
  return n
input()
A = input().split(' ')
A = [int(x) for x in A]
print(ans(A))

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

ans = 1

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

Solution (Python):
n=int(input())
a=input().split()
a=list(map(int,a))
ans=1
if(0 in a):
    print(0)
    exit()

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

Solution (Python):
N = int(input())
arr = list(map(int,input().split()))

if 0 in arr:
    print(0)
else:
    r = 1
    for i in arr:
        if r*i > 10**18:
            print(-1)
            exit()
        r *= i
    print(r)

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

ans = A[0]

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

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

print(ans)

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


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

print(ans)

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

bb = 10**18

def main():
    n = ii()
    a = li()
    ans = 1

    if 0 in a:
        print(0)
        return

    for i in range(len(a)):
        ans *= a[i]
        if ans > bb:
            print(-1)
            break
    else:
        print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
A=sorted(map(int,input().split()))
mul=1
for a in A:
    mul*=a
    if mul>10**18:
        mul=-1
        break
print(mul)

Solution (Python):
from functools import reduce

def m(l):
    result = 1
    for num in l:
        result *= num
        if result == 0:
            return 0
        elif result > 10**18:
            return -1
    return result

if __name__ == "__main__":
    input()
    aList = list(map(int, input().split()))
    aList.sort()
    print(m(aList))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
a = 1
if 0 in A:
    print(0)
    exit()
for i in A:
    a *= i
    if a > 10**18:
        print('-1')
        exit()
print(a)

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

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

Solution (Python):
N = int(input())
As = list(map(int,input().split()))
sum = 1
if 0 in As:
    print(0)
    exit()
for i in As:
    sum *=i
    if sum>10**18:
        sum = -1
        break
print(sum)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
ans = 1
 
for n in range(N):
 ans = L[n]*ans
 if ans >= 1000000000000000001: ans = -1
 if ans == -1: break
 
for n in range(N):
 if L[n] == 0: ans = 0
print(ans)

Solution (Python):
a = int(input())
li = list(map(int,input().split()))
total = 1
i = 1
for i in range(a):
    total = total*li[i]
    if total > 1000000000000000000:
        total = -1
        break
for i in range(a):
    if li[i] == 0:
        total = 0
 
print(total)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
result = 1
flag = 0
zero_flag = 0
for a in A:
    if a == 0:
        zero_flag = 1
        result = 0
        break
    else:
        result = result * a
        if result > pow(10, 18):
            flag = 1
            result = 0
if flag == 1 and zero_flag != 1:
    print(-1)
else:
    print(result)

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

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

Solution (Python):
_=input()
val=1
t=10**18

for i in map(int,input().split()):
  if i==0:
    val*=i
    break
  if val>=t: continue
  val*=i

if val>t:
  print(-1)
  exit()

print(val)

Solution (Python):
_=input()
val=1
t=10**18

for i in map(int,input().split()):
  if i==0:
    val*=i
    break
  if val>=t: continue
  val*=i

if val>t:
  print(-1)
  exit()

print(val)

Solution (Python):
n = int(input())
s = sorted(map(int,input().split()))
M = 10 ** 18
ans = 1
for ss in s:
	ans *= ss
	if ans > M:
		ans = -1
		break
	elif ans == 0:
		break
print(ans)

Solution (Python):


N = int(input())
L = list(map(int, input().split()))
ans = 1

for n in range(N):
 ans = L[n]*ans
 if ans >= 1000000000000000001: ans = -1
 if ans == -1: break

for n in range(N):
 if L[n] == 0: ans = 0
print(ans)

Solution (Python):
n=int(input())
x = list(map(int, input().split()))
val=1
length=range(n)
zflag=0
flag=0
for i in length:
    if x[i]==0:
        zflag=1;
if zflag==1:
    print(0)
else:
    for i in length:
        val=val*x[i];
        if val>1000000000000000000:
            print(-1)
            flag=1
            break
    if flag==0:
        print(val)

Solution (Python):
a=int(input())
b=input().split(" ")
sum1=1

if "0" in b:
	print("0")
else:
	for i in range(a):
		sum1=sum1*int(b[i])
		if sum1>10**18:
			sum1=-1
			break
	print(sum1)

Solution (Python):
def mul(m) : 
      
    
    res = 1
    for x in m: 
        res = res * x
        if res == 0:
             return 0 
        if res > 10**18:
             return -1
    return res
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
z = mul(a)
print(z)

Solution (Python):

def main():
    import sys
    imput = sys.stdin.readline
    
    
    
    N = int(input())
    A = list(map(int, input().split()))

    
    A = sorted(A, reverse = True)
    if A[-1] == 0:
        print(0)
        exit()
        
    answer = 1
    limit = pow(10, 18)
    for i in range(N):
        answer *= A[i]
        if answer > limit:
            print(-1)
            exit()
        else:
            continue

    print(answer)

    
if __name__ == "__main__":
    main()

Solution (Python):
_ = int(input())
A = [ int(i) for i in input().strip().split(' ')]
a = 1
if min(A) == 0:
    print(0)
else:
    for Ai in A:
        a *= Ai
        if a > 10**18:
            print('-1')
            break
    else:
        print(a)

Solution (Python):
n = input()
x = list(map(int,input().split()))
x.sort()
sum = 1
done = False



for i in x:

    
    if i == 0:
        sum = 0
        break

    sum = sum * i

    if sum > 10**18:
        break

    



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

Solution (Python):
n= int(input())
a= list(map(int,input().split()))
 
ans = 1
over = -1
 
if 0 in a:
    print(0)
    exit(0)

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

print(ans)

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

total = 1
li.sort()
for a in li:
    if a == 0:
        total = 0
        break
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
print(total)

Solution (Python):
a = int(input())
li = list(map(int,input().split()))
total = 1
i = 1
for i in range(a):
    total = total*li[i]
    if total > 1000000000000000000:
        total = -1
        break
for i in range(a):
    if li[i] == 0:
        total = 0

print(total)

Solution (Python):
i =0
ans = 1
N = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(0)
else:
  while ans<10**18 and i<len(a):
    ans*=a[i]
    i+=1
  if(ans<= 10 ** 18):
    print(ans)
  else:
    print(-1)

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

Solution (Python):

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

B = set(A)
Answer = 1
if 0 in B:
    print(0)
    exit()
for i in range(N):
    Answer *= A[i]
    if Answer > 1000000000000000000:
        print(-1)
        exit()
print(Answer)

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

total = 1
li.sort()
for a in li:
    if a == 0:
        total = 0
        break
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
print(total)

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

Solution (Python):
import math
import sys
N = int(input())
mylist = list(map(int, input().split()))
mylist.sort(reverse = True)

if mylist[-1] == 0:
    print(0)
    sys.exit()
else:
    myans = 1
    for m in mylist:
        myans *= m
        if myans > 10**18:
            print(-1)
            sys.exit()
    print(myans)

Solution (Python):
import sys

n= int(input())
a = list(map(int,input().split()))
ans = a[0]
ans_max = 10 ** 18

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

for i in range(1, n):
    ans *= a[i]
    if ans > ans_max:
        print("-1")
        sys.exit()

print(ans)

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

Solution (Python):

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

thre = 10**18

a.sort(reverse=True)


flag = 0
tm = a[n-1]
if(tm==0):
  print(0)
else:
  tmp=a[0]
  for i in range(1,n):
    tmp*= a[i]
    if(tmp > thre):
      flag = 1
      break
  if(flag == 1):
    print(-1)
  else:
    print(tmp)

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

Solution (Python):
import numpy as np

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

if any([i == 0 for i in a]):
    print('0')
else:
    for i in range(n):
        x = a[i]
        t = t * x
        if x == 0:
            break
        if t > 10**18:
            break

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

Solution (Python):
_ = input()
inp = list(map(int, input().split()))

re = 1


for a in inp:
    re = re * a
    if re > (10**18):
        of = True
        re = -1
        break


for a in inp:
    if a == 0:
        re = 0


print(re)

Solution (Python):
from sys import stdin
N = int(input())
A = list(map(int, stdin.readline().split()))
if 0 in A:
    print(0)
else:
    ans = 1
    for a in A:
        ans = ans*a
        if ans > 10**18:
            break
    """from functools import reduce
    ans = reduce(lambda x,y:x*y,A)"""
    """import numpy as np
    A = np.array(A)
    ans = np.prod(A)"""
    if ans >10**18:
        print(-1)
    else:
        print(ans)

Solution (Python):
import math
n = int(input())
li = sorted(list(map(int,input().split())), reverse = True)

if 0 in li:
    print(0)
else:
    ans = 1
    limit = 10**18
    for i in range(n):
        if li[i] > limit:
            ans = -1
            break
        else:
            ans = ans * li[i]
            limit = limit/li[i]
    if ans > 10**18:
        ans = -1
    print(ans)

Solution (Python):
num = int(input())
str2 = input().split(" ")
nums = [int(s) for s in str2]
nums.sort()

ans = 1

for i in range(len(nums)):
    ans = ans * nums[i]
    if(ans > 1000000000000000000):
        print(-1)
        quit()
print(ans)

Solution (Python):
import numpy as np
INF = 10 **18
N= int(input())

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



def calc(A):
    if 0 in A:
        return 0
    ans = A.pop()
    for a in A:


        ans *= a
        if ans > INF:
            
            return -1
    return ans






print(calc(A))

Solution (Python):
a = int(input())
b = input().split()
c = 1
for i in range(a):
    if int(b[i]) == 0:
        c = 0

if c == 1:
    for i in range(a):
        c = c*int(b[i])
        if c > 1000000000000000000:
            break

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

Solution (Python):
A=input()
list1=input().split()
A=int(A)
Ans=1


if "0" in list1:
    print("0")
    
else:
    for i in range(0,A):
        Ans=Ans*int(list1[i])    
        if Ans >10**18:
                print(-1)
                break
    if Ans <=10**18:    
        print(Ans)

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

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

if 0 in A:
    print(0)
else:
    now=1
    ok=True
    for a in A:
        now*=a;
        if now>1e18:
            ok=False
            break
    if ok:
        print(now)
    else:
        print(-1)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
INF = 10**18
ans = 1
if 0 in A:
    print(0)
    exit()

for a in A:
    ans *= a
    if ans > INF:
        print(-1)
        exit()
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
i = 1
if 0 in a:
  print(0)
  exit()

for x in a:
  i *= x
  if i > 10 ** 18:
    break


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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 1
if 0 in a:
    print(0)
    exit()

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

print(ans)

Solution (Python):
n = int(input())
res = 1
ls = input().split(' ')
list.sort(ls)
if int(ls[0]) == 0:
    print(0)
    exit()
for a in ls:
    res = res * int(a)
    if res > 1000000000000000000:
        print(-1)
        exit()
print(res)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
if a[0] == 0:
  print(0)
  exit()

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

Solution (Python):
n=input()
x=[int(i) for i in input().split()]
x.sort()
prod=1
for i in x:
  prod=prod*i
  if prod>1000000000000000000:
    break
if prod>1000000000000000000:
  print(-1)
else:
  print(prod)

Solution (Python):
n = int(input())
v = input().split(' ')

prod = 1

v.sort()

for i in v:
  prod *= int(i)
  if int(prod) > int(1e18):
    prod = -1
    break
print(prod)

Solution (Python):
N = int(input())
A = []
A  = list(map(int,input().split()))	
if A.count(0)!=0:
    print("0")
    exit()
ans = 1
for i in A:
    ans = ans*i
    if ans > 1000000000000000000:
        print("-1")
        exit()
print(ans)

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

Solution (Python):
import sys
n = int(input())
l = list(map(int,input().split()))
for i in range(n):
    if l[i]==0:
        print(0)
        sys.exit()
ans = 1
for i in range(n):
    ans *= l[i]
    if ans > 1e18:
        print(-1)
        sys.exit()
print(ans)