Kyoya Ootori has a bag with *n* colored balls that are colored with *k* different colors. The colors are labeled from 1 to *k*. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag is empty. He noticed that he drew the last ball of color *i* before drawing the last ball of color *i* + 1 for all *i* from 1 to *k* - 1. Now he wonders how many different ways this can happen.
The first line of input will have one integer *k* (1 ≤ *k* ≤ 1000) the number of colors.

Then, *k* lines will follow. The *i*-th line will contain *c*<sub class="lower-index">*i*</sub>, the number of balls of the *i*-th color (1 ≤ *c*<sub class="lower-index">*i*</sub> ≤ 1000).

The total number of balls doesn't exceed 1000.
from math import exp

def pfold (arr):
    return arr[0] * pfold (arr[1:]) if arr else 1

def pscan (x, arr):
    arr = (pscan (x * arr[-1], arr[:-1]) if arr else [])
    arr.append(x)
    return arr

def P(n, r):
    return pfold(range(n, n-r, -1))

def F(n):
    return P(n, n)
    #return reduce(op.mul, range(n, 0, -1), 1)

def C(n, r):
    if (r > n): return 0
    r = min(r, n-r)
    return P(n, r)//F(r)

def AC(a, b):
    return C(a+b-1, b-1)

def CCC(n, k):
    return AC(n, k)/F(k)

def Cat(n):
    return C(2*n,n+1)/n

def Cat2(n):
    return 

def dot(a,b):
    return sum(i*j for i, j in zip(a,b))

def Catray(n):
    arr = [1]
    for i in range(1,n):
        arr = arr + [dot(arr,arr[::-1])]
    return arr

# binomial distribution:
# with an event E which has probability p of occuring every try, 
# what is the chance of E occuring exactly k times from n tries
def Bd (n, p, k):
    return C(n,k)*p**k*(1-p)**(n-k)

# evaluate the sum of the binomial distribution in the range [0, k]
def BdS (n, p, k):
    return sum(Bd(n, p, i) for i in range(k+1))

def Normal (mu, sigma, k):
    return 0

# exponential distribution
def Ed (p, k):
    return (1-p)*p**(k-1)

def EdS (p, k):
    return 1 - p**k

def Pd (x, k):
    return x**k/F(k) * exp(-x)

def PdS (x, k):
    return (sum(pscan (1, [x/i for i in range (k, 0, -1)]))) * exp(-x)

#def PPP(n, k, m):



def nTermsSumToXInRangeAToB(n, x, a, b): # a <= b
     x -= a*n
     b -= a
     if x < 0 or x > b*n:
         return 0
     else:
         return nTermsUnderASumToX(n, x, b+1, 0)
     

def nTermsUnderASumToX(n, x, a, b):
    if x < 0:
        return 0
    else:
        return AC(x,n) - (n-b)*nTermsUnderASumToX(n, x-a, a, b+1)

def f(n, x, a, b):
    return nTermsSumToXInRangeAToB(n, x, a, b)

M = 10**9+7
k = int(input())
v = 1
n = 0
for _ in range(k):
    c = int(input())
    v *= C(n+c-1,c-1)
    c %= M
    n+= c
print(v)
    
    





	 	     	     		  													