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 __future__ import print_function # for PyPy2
from collections import Counter, OrderedDict
from itertools import permutations as perm
from fractions import Fraction
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
# from math import *

g   = lambda : stdin.readline().strip()
gl  = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1e9)+7
inf = float("inf")                      



ans = 0
n, = gil()
c = []
for _ in range(n):
	c.append(gil()[0])
N = sum(c)

fac = [1]*(N+1)

for i in range(2, N+1):
	fac[i] *= fac[i-1]*i
	fac[i] %= mod


ans = fac[N-2]
# print(N-2, fac[N-2])

def inv(x):
	# print("inv of ", x)
	return pow(x, mod-2, mod)

for i in range(n-2):
	ans *= inv(fac[c[i]])

	ans %= mod

ans *= inv(fac[c[-1]-1])*inv(fac[c[-2]-1])
ans %= mod

print(ans)