#include <bits/stdc++.h>
using namespace std;

long long degree(long long a, long long k, long long p) {
  long long res = 1, cur = a;
  while (k) {
    if (k % 2) res = (res * cur) % p;
    k >>= 1, cur = (cur * cur) % p;
  }
  return res;
}

long long degree(long long n, long long p) {
  long long degree_num = 0, u = p, temp = n;
  while (u <= temp) degree_num += (temp / u), u *= p;
  return degree_num;
}

long long ncr(int n, int r, long long mod) {
  long long num_degree = degree(n, mod) - degree(n - r, mod);
  long long den_degree = degree(r, mod);

  if (num_degree > den_degree)
    return 0;

  long long res = 1;
  for (long long i = n; i > n - r; --i) {
    long long ti = i;
    while ((ti % mod) == 0)
      ti /= mod;
    res = (res * ti) % mod;
  }

  for (long long i = 1; i <= r; ++i) {
    long long ti = i;
    while ((ti % mod) == 0)
      ti /= mod;
    res = (res * degree(ti, mod - 2, mod)) % mod;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int combArr[1001][503];
  const int MOD = 1000000007;
  combArr[1][1] = combArr[2][1] = combArr[2][2] = 1;
  for (int i = 3; i <= 1000; ++i) {
    combArr[i][1] = 1;
    for (int g = 2; g <= (i >> 1); ++g)
      combArr[i][g] = (combArr[i - 1][g] + combArr[i - 1][g - 1]) % MOD;

    if (i & 1)
      combArr[i][(i >> 1) + 1] = (combArr[i - 1][(i >> 1)] << 1) % MOD;
  }

  long long k, sum, cur, res = 1, tmpRes = 0;
  cin >> k >> sum;
  for (int i = 1; i < k; ++i) {
    cin >> cur, --cur, tmpRes = 0;
    for (int g = 1; g <= (cur >> 1) && g <= (sum + 1); ++g) {
      tmpRes += (((ncr(sum + 1, g, MOD)) *
          combArr[cur][g]) % MOD), tmpRes %= MOD;
      tmpRes += (((ncr(sum + 1, cur - g + 1, MOD)) *
          combArr[cur][g]) % MOD), tmpRes %= MOD;
    }

    if ((cur & 1) && ((cur >> 1) <= sum))
      tmpRes += (((ncr(sum + 1, (cur >> 1) + 1, MOD)) *
          combArr[cur][(cur >> 1) + 1]) % MOD), tmpRes %= MOD;

    if (tmpRes) res *= tmpRes, res %= MOD;
    sum += (cur + 1);
  }

  cout << res;
  return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define forn(i,n) for(int i = 0;i<n;i++)
#define for1(i,n) for(int i = 1;i<=n;i++)
#define pb push_back
//#define mp make_pair
#define all(x) (x).begin(),(x).end()
//#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
const int maxn = 20000005;
int gcd(int a,int b) { return b?gcd(b,a%b):a;}
//ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int INF = 0x3f3f3f3f;

//head
const int N = 100000 + 5;
const int MOD = (int)1e9 + 7;
ll F[N], Finv[N], inv[N];//F是阶乘，Finv是逆元的阶乘
void init(){
    inv[1] = 1;
    for(int i = 2; i < N; i ++){
        inv[i] = (MOD - MOD / i) * 1ll * inv[MOD % i] % MOD;
    }
    F[0] = Finv[0] = 1;
    for(int i = 1; i < N; i ++){
        F[i] = F[i-1] * 1ll * i % MOD;
        Finv[i] = Finv[i-1] * 1ll * inv[i] % MOD;
    }
}
int comb(int n, int m){//comb(n, m)就是C(n, m)
    if(m < 0 || m > n) return 0;
    return F[n] * 1ll * Finv[n - m] % MOD * Finv[m] % MOD;
}
ll num[1005],dp[1005],a[1005];
int main() {
    init();
    int n;
    cin>>n;
    for1(i,n){
        cin>>a[i];
        num[i]= num[i-1] + a[i];
    }
    dp[1] = 1;
    for(int i = 2;i<=n;i++){
        dp[i] = dp[i-1] * comb(num[i]-1,a[i]-1) % MOD;
    }
    cout<<dp[n];

}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define forn(i,n) for(int i = 0;i<n;i++)
#define for1(i,n) for(int i = 1;i<=n;i++)
#define pb push_back
//#define mp make_pair
#define all(x) (x).begin(),(x).end()
//#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
const int maxn = 20000005;
int gcd(int a,int b) { return b?gcd(b,a%b):a;}
//ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int INF = 0x3f3f3f3f;

//head
const int N = 100000 + 5;
const int MOD = (int)1e9 + 7;
ll F[N], Finv[N], inv[N];//F是阶乘，Finv是逆元的阶乘
void init(){
    inv[1] = 1;
    for(int i = 2; i < N; i ++){
        inv[i] = (MOD - MOD / i) * 1ll * inv[MOD % i] % MOD;
    }
    F[0] = Finv[0] = 1;
    for(int i = 1; i < N; i ++){
        F[i] = F[i-1] * 1ll * i % MOD;
        Finv[i] = Finv[i-1] * 1ll * inv[i] % MOD;
    }
}
int comb(int n, int m){//comb(n, m)就是C(n, m)
    if(m < 0 || m > n) return 0;
    return F[n] * 1ll * Finv[n - m] % MOD * Finv[m] % MOD;
}
int num[1005],dp[1005],a[1005];
int main() {
    init();
    int n;
    cin>>n;
    for1(i,n){
        cin>>a[i];
        num[i]= num[i-1] + a[i];
    }
    dp[1] = 1;
    for(int i = 2;i<=n;i++){
        dp[i] = dp[i-1] * comb(num[i]-1,a[i]-1) % MOD;
    }
    cout<<dp[n];

}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define PT(a) cout << (a) << '\n'
#define exit exit(0)
#define sz(a) (a).size()
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

#define F0r(i, a, b) for(int i = a; i < b; ++i)
#define f0r(i, a) for(int i = 0; i < a; ++i)
#define F0rd(i, a, b) for(int i = a - 1; i > b; --i)
#define f0rd(i, a) for(int i = a - 1; i >= 0; --i)
#define trav(i, a) for(auto& i : (a))
void P(int x) {cout << x << '\n';}
void PP(int a, int b) {cout << a << " " << b << '\n';}
void PV(vi v) {int n = sz(v); trav(i, v) cout << i << " ";cout << '\n';}
void PPV(vpi v) {int n = sz(v); trav(i, v) cout << i.F << " " << i.S << '\n';}

const ll INF = (1LL << 60);
const int MOD = 1e9 + 7;
const int nax = 2e5 + 5;
const double p = 3.14159265359;

ll comb[1010][1010];
void pre(){
   comb[0][0] = 1;
   F0r(i, 1, 1010){
      comb[i][0] = 1;
      F0r(j, 1, i + 1){
         comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD;
      }
   }
}

int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   pre();
   int n;
   cin >> n;
   int tot = 0;
   ll res = 1;
   int x = 0;
   f0r(i, n){
      cin >> x;
      res = (res % MOD * comb[tot + x - 1][x - 1] % MOD) % MOD;
      tot += x;
   }
   PT(res);

   return 0;
}


#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include<unordered_map>
#include <set>
#include<unordered_set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <math.h>

#define lli long long int
#define ld long double
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

lli ncr[1003][1003];
void solve()
{
    lli k;
    cin>>k;
    lli c[k + 1];
    ncr[0][0] = 1;
    for(int i = 1; i <= 1000; i ++) {
        ncr[i][0] = 1;
        for(int j = 1; j <= i; j ++) {
            ncr[i][j] = (ncr[i - 1][j] + ncr[i - 1][j - 1]) % mod;
            ncr[i][j] %= mod;
        }
    }
    for(int i = 1; i <= k; i ++)  {
        cin>>c[i];
    }
    lli ans = 1;
    lli sum = c[1];
    for(int i = 2; i <= k; i ++) {
        ans = (ans * ncr[sum + c[i] - 1][c[i] - 1]) % mod;
        ans %= mod;
        sum += c[i];
    }
    ans %= mod;
    cout<<ans;
    cout<<'\n';
    return ;
}

/*
*/

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

//    pre();

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}
/*
*/


#include<iostream>
#include<vector>

#include<cstring>
#include<cstdio>
#include<climits>
#include<cmath>
#include<algorithm>
#include<queue>
#include<deque>
#include<map>
#include<set>
#define mod 1000000007
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define N 300010
using namespace  std;
int a[N];
int b[N];
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int n,m;

ll re=1;
int vis[N];
int primes[N];
int st[N];
int main(){
   int k;
   cin>>k;
   int sum=0;
   for(int i=0;i<k;i++){
       int a;
       cin>>a;
   if(i<k-1)sum+=a;
   else
       sum+=max(0,a-2);
   }
    for(int i=sum;i>k-1;i--){
        if(i==4)continue;
        re=(re*i)%mod;
    }
    re=re%mod;
    printf("%lld",re);
    return 0;
}


#include<iostream>
#include<vector>

#include<cstring>
#include<cstdio>
#include<climits>
#include<cmath>
#include<algorithm>
#include<queue>
#include<deque>
#include<map>
#include<set>
#define mod 1000000007
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define N 300010
using namespace  std;
int a[N];
int b[N];
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int n,m;

ll re=1;
int vis[N];
int primes[N];
int st[N];
int main(){
   int k;
   cin>>k;
   int sum=0;
   for(int i=0;i<k;i++){
       int a;
       cin>>a;
   if(i<k-1)sum+=a;
   else{

   }
    for(int i=sum;i>k-1;i--){
        if(i==4)continue;
        re=(re*i)%mod;
    }
    re=re%mod;
    printf("%lld",re);
    return 0;
}


#include<iostream>
#include<vector>

#include<cstring>
#include<cstdio>
#include<climits>
#include<cmath>
#include<algorithm>
#include<queue>
#include<deque>
#include<map>
#include<set>
#define mod 1000000007
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define N 300010
using namespace  std;
int a[N];
int b[N];
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int n,m;

ll re=1;
int vis[N];
int primes[N];
int st[N];
int main(){
   int k;
   cin>>k;
   int sum=0;
   for(int i=0;i<k;i++){
       int a;
       cin>>a;
   if(i<k-1)sum+=a;
   else
       sum+=a/2;
   }
    for(int i=sum;i>k-1;i--){
        if(i==4)continue;
        re=(re*i)%mod;
    }
    re=re%mod;
    printf("%lld",re);
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define LL long long
const LL mod =  1000000007;
LL n;
LL a[1005];
LL fac[1000005];

LL ppow(LL a,LL b)
{
    LL c=1;
    while(b)
    {
        if(b&1) c=c*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return c;
}

LL work(LL m,LL i)
{
    return ((fac[m]%mod)*(ppow((fac[i]*fac[m-i])%mod,mod-2)%mod))%mod;
}

int main()
{
    LL i,j,k;
    fac[0] = 1;
    for(i = 1; i<1000005; i++)
        fac[i]=(fac[i-1]*i)%mod;
    LL ans = 1,sum = 0;
    scanf("%I64d",&n);
    for(i = 1; i<=n; i++)
    {
        scanf("%I64d",&a[i]);
        sum+=a[i];
    }
    for(i = n; i>=1; i--)
    {
        ans*=work(sum-1,a[i]-1);
        ans%=mod;
        sum-=a[i];
    }
    printf("%I64d\n",ans);

    return 0;
}


#include<iostream>
#include<vector>

#include<cstring>
#include<cstdio>
#include<climits>
#include<cmath>
#include<algorithm>
#include<queue>
#include<deque>
#include<map>
#include<set>
#define mod 1000000007
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define N 300010
using namespace  std;
int a[N];
int b[N];
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int n,m;

ll re=1;
int vis[N];
int primes[N];
int st[N];
int main(){
   int k;
   cin>>k;
   int sum=0;
   for(int i=0;i<k;i++){
       int a;
       cin>>a;
   if(i<k-1)sum+=a;
   else{}
   }
    for(int i=sum;i>k-1;i--){
        if(i==4)continue;
        re=(re*i)%mod;
    }
    re=re%mod;
    printf("%lld",re);
    return 0;
}


#include<iostream>
#include<vector>

#include<cstring>
#include<cstdio>
#include<climits>
#include<cmath>
#include<algorithm>
#include<queue>
#include<deque>
#include<map>
#include<set>
#define mod 1000000007
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define N 300010
using namespace  std;
int a[N];
int b[N];
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int n,m;

ll re=1;
int vis[N];
int primes[N];
int st[N];
int main(){
   int k;
   cin>>k;
   int sum=0;
   for(int i=0;i<k;i++){
       int a;
       cin>>a;
   if(i<k-1)sum+=a;
   else

   }
    for(int i=sum;i>k-1;i--){
        if(i==4)continue;
        re=(re*i)%mod;
    }
    re=re%mod;
    printf("%lld",re);
    return 0;
}


#define rep(i,a,b) for(int i=a;i<b;++i)
#define repr(i,a,b) for(int i=a,i > b;--i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)

#define null NULL
#define eps 0.000000001
#define mod 1000000007
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (ll)V.size()
#define _ <<" "<<

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <iterator>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <limits.h>
#include <iomanip>
#include <cctype>
#include <numeric>
#include <complex>

using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<int,int> ii;
typedef vector<int> vii;

const int N = 1e3+2;
const int M = 1e6+2;
vi cnt(N);
vi inv(1000002);
vi fact(1000002);
vi inv_fact(10000002);

ll C(int n,int k){
	if(k == 0 || k == n) return 1;
	ll num = (fact[n]*inv_fact[k])%mod;
	num = (num*(inv_fact[n-k]) )%mod;
	return num;
}

void fill(){
	fact[0] = fact[1] = 1;
	for(int i = 2;i<M;i++){
		fact[i] = (fact[i-1]*i)%mod;
	}
	inv[1] = 1;
	for(int i = 2;i<M;i++){
		inv[i] = (mod - ((mod/i)*inv[mod%i] )%mod)%mod;
	}
	inv_fact[1] = 1;
	for(int i = 2;i<M;i++){
		inv_fact[i] = (inv_fact[i-1]*inv[i])%mod;
	}
}
int k;
int main(){
	cin>>k;
	rep(i,0,k){
		cin>>cnt[i];
	}
	ll ans = 1,cur = cnt[0];
	fill();
	for(int i = 1;i<=k-1;i++){
		//cout<<ans<<" "<<cur+cnt[i]-1<<" "<<cur<<" "<<C(cur+cnt[i]-1,cur)<<endl;
		ans*= C(cur+cnt[i]-1,cur);
		ans%=mod;
		cur += cnt[i];
	}
	cout<<ans<<endl;
	//rep(i,0,10) cout<<fact[i]<<" "<<inv[i]<<" "<<inv_fact[i]<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, s, n) for(int i = s; i < n; i++)
#define rRep(i, n) for(int i = n - 1; i >= 0; i--)

const int N = 1002;
const int MOD = 1e9 + 7;
int c[N][N];

void combine() {
	c[0][0] = 1;
	for(int i = 1; i < N; i++) {
		c[i][0] = c[i][i] = 1;
		for(int j = 1; j < i; j++) {
			c[i][j] = c[i - 1][j - 1]%MOD + c[i - 1][j]%MOD;
			c[i][j] %= MOD;
		}
	}
}

int32_t main() {
	FAST
	int k;
	cin >> k;

	vector<int> balls(k), pre(k + 1, 0);
	REP(i, 0, k) {
		cin >> balls[i];
		pre[i + 1] = balls[i] + pre[i];
		//cout << pre[i + 1] << " ";
	}
	combine();
	int ans = 1;
	for(int i = k; i > 0; i--) {
		ans *= c[pre[i] - 1][balls[i - 1] - 1];
		ans %= MOD;
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
typedef long long INT;
INT fac[3030];
void pre(){
    fac[0] = 1;
    for(int i= 1;i <= 2020;i++){
        fac[i] = fac[i-1] * i % mod;
    }
}
int power(int a,int b,int m,int ans=1){
    for(;b;b>>=1,a=1LL*a*a%m){
        if(b&1){
            ans = 1LL* ans * a  % m;
        }
    }
    return ans;
}

INT  sol(int n, int k){
    INT ans = fac[n+k-1];
    ans *= power(fac[k],mod-2,mod); ans %= mod;
    ans *= power(fac[n-1],mod-2,mod); ans %= mod;
    return ans;
}

int main()
{
    pre();
    int k;scanf("%d",&k);
    INT ans=1,tot=0;
    for(int i=1,a;i<=k;i++){
        scanf("%d",&a);
        ans*=sol(tot+1,a-1);tot+=a;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


#include <iostream>

using namespace std;

const int N = 1100;
long long c[N][N];
int a[N];

int main()
{
    int n;
    cin >> n;
    int s = 0;
    for (int i = 0; i < n; i ++){
        cin >> a[i];
        s += a[i];
    }
    long long e = 1000 * 1000 * 1000 + 7;
    for (int i = 0; i < N; i ++){
        c[i][0] = c[i][i] = 1;
        for (int j = 1; j < i; j ++){
            c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % e;
        }
    }
    long long ans = 1;
    for (int i = n - 1; i >= 0; i --){
        ans = (ans * c[s - 1][a[i] - 1]) % e;
        s -= a[i];
    }
    cout << ans % e;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef double db;
typedef vector<vi> vvi;
const ll mod=1000000007;
const ll N=1000005; //check this
const ll inf = 1e17;
ll powmod(ll a,ll b) {if(b<0)b=mod-1+b;ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll powb(ll a,ll b) {ll res=1;a ; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll fact[1001]={0};
    fact[0]=1;
    for(ll i=1;i<=1000;i++)fact[i]=fact[i-1]*i%mod;
    int k;cin>>k;
    ll pre[k]={0},a[k];
    for(int i=0;i<k;i++)cin>>a[i];
    ll ans=1;
    ll tot=a[0];
    for(int i=1;i<k;i++){
        (tot+=a[i])%mod;
        (ans*=fact[tot-1])%=mod;
        (ans*=powmod(fact[a[i]-1],-1))%=mod;
        (ans*=powmod(fact[tot-a[i]],-1))%=mod;
    }
    cout<<ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
const ll mod = 1e9 + 7;

ll fac[maxn], ifac[maxn];

ll modpow(ll, ll);
ll inv(ll);
ll nck(ll, ll);
void build();
void testlib();

int k, c[maxn], acc[maxn];

int f[maxn];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  build();

  cin>>k;
  for (int i=1; i<=k; i++) {
    cin>>c[i];
    acc[i] = c[i] + acc[i-1];
  }

  f[1] = 1;
  for (int i=2; i<=k; i++) {
    f[i] = nck(acc[i]-1, c[i]-1) * f[i-1];
    f[i] %= mod;
  }

  cout<<f[k]<<endl;

  return 0;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

ll modpow(ll x, ll y) {
  x %= mod;
  ll res = 1;
  while (y > 0) {
    if (y%2 == 1) {
      res *= x;
      res %= mod;
    }
    x = x * x;
    x %= mod;
    y = y / 2;
  }
  return res;
}

ll inv(ll x) {
  assert(x != 0);
  return modpow(x, mod-2);
}

void build() {
  fac[0] = ifac[0] = 1;
  for (int i=1; i<maxn; i++) {
    fac[i] = fac[i-1] * i;
    fac[i] %= mod;
    ifac[i] = inv(fac[i]);
    ifac[i] %= mod;
  }
}

ll nck(ll n, ll k) {
  assert(n>=0 && k>=0);
  if (k > n) return 0;
  return (((fac[n] * ifac[k]) % mod) * ifac[n-k]) % mod;
}

void testlib() {
  assert(modpow(1,1) == 1);
  assert(modpow(4,2) == 16);
  assert(modpow(2,5) == 32);
  assert(fac[3] == 6);
  assert(nck(4,2) == 6);
  assert(nck(10,2) == 45);
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
const ll mod = 1e9 + 7;

ll fac[maxn], ifac[maxn];

ll modpow(ll, ll);
ll inv(ll);
ll nck(ll, ll);
void build();
void testlib();

int k, c[maxn], acc[maxn];

ll f[maxn];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  build();

  cin>>k;
  for (int i=1; i<=k; i++) {
    cin>>c[i];
    acc[i] = c[i] + acc[i-1];
  }

  f[1] = 1;
  for (int i=2; i<=k; i++) {
    f[i] = nck(acc[i]-1, c[i]-1) * f[i-1];
    while (f[i] < 0) f[i] += mod;
    f[i] %= mod;
  }

  f[k] %= mod;
  cout<<f[k]<<endl;

  return 0;
}

///////////////////////////////////////////////////////////////////////////////////////////////////

ll modpow(ll x, ll y) {
  x %= mod;
  ll res = 1;
  while (y > 0) {
    if (y%2 == 1) {
      res *= x;
      res %= mod;
    }
    x = x * x;
    x %= mod;
    y = y / 2;
  }
  return res;
}

ll inv(ll x) {
  assert(x != 0);
  return modpow(x, mod-2);
}

void build() {
  fac[0] = ifac[0] = 1;
  for (int i=1; i<maxn; i++) {
    fac[i] = fac[i-1] * i;
    fac[i] %= mod;
    ifac[i] = inv(fac[i]);
    ifac[i] %= mod;
  }
}

ll nck(ll n, ll k) {
  assert(n>=0 && k>=0);
  if (k > n) return 0;
  ll res = (((fac[n] * ifac[k]) % mod) * ifac[n-k]) % mod;
  assert(res > 0);
  return res;
}

void testlib() {
  assert(modpow(1,1) == 1);
  assert(modpow(4,2) == 16);
  assert(modpow(2,5) == 32);
  assert(fac[3] == 6);
  assert(nck(4,2) == 6);
  assert(nck(10,2) == 45);
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author parsa bahrami
 */

#pragma GCC optimize("O2")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key , find_by_order
#define sz(x)                       (ll) x.size()
#define jjoin(x)                    for (auto i : x) cout << i << endl;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define sep                         ' '
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define kill(x)                     return cout << x << endl , 0;
#define Hkill(x)                    cout << x << endl; exit(0);
#define endl                        '\n'

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 2e5 + 10;
const ll MAXA = 1010;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ld PI = 4 * atan((ld) 1);
ll counting[MAXA][MAXA], C[MAXN], ps[MAXN], k;

ll cnt(ll i, ll j) {
    if (counting[i][j] != -1) return counting[i][j];
    if (i == j || i == 0) {
        counting[i][j] = 1;
        return 1;
    }
    counting[i][j] = (cnt(i, j - 1) + cnt(i - 1, j - 1)) % MOD;
    return counting[i][j];
}

int main() {
    fast_io;
    set_random;
    memset(counting, -1, sizeof counting);
    cin >> k;
    for (ll i = 1; i <= k; i++) {
        cin >> C[i];
    }
    partial_sum(C + 1, C + k + 1, ps + 1);
    ll ans = 1;
    for (ll i = 1; i <= k; i++) {
        ans = (ans * cnt(C[i] - 1, ps[i - 1] + C[i] - 1)) % MOD;
    }
    cout << ans << endl;
    return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author parsa bahrami
 */

#pragma GCC optimize("O2")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key , find_by_order
#define sz(x)                       (ll) x.size()
#define jjoin(x)                    for (auto i : x) cout << i << endl;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define sep                         ' '
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define kill(x)                     return cout << x << endl , 0;
#define Hkill(x)                    cout << x << endl; exit(0);
#define endl                        '\n'

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 2e5 + 10;
const ll MAXA = 1010;
const ll INF = 8e18;
const ll MOD = 998244353; //1e9 + 7
const ld PI = 4 * atan((ld) 1);
ll counting[MAXA][MAXA], C[MAXN], ps[MAXN], k;

ll cnt(ll i, ll j) {
    if (counting[i][j] != -1) return counting[i][j];
    if (i == j || i == 0) {
        counting[i][j] = 1;
        return 1;
    }
    counting[i][j] = (cnt(i, j - 1) + cnt(i - 1, j - 1)) % MOD;
    return counting[i][j];
}

int main() {
    fast_io;
    set_random;
    memset(counting, -1, sizeof counting);
    cin >> k;
    for (ll i = 1; i <= k; i++) {
        cin >> C[i];
    }
    partial_sum(C + 1, C + k + 1, ps + 1);
    ll ans = 1;
    for (ll i = 1; i <= k; i++) {
        ans = (ans * cnt(C[i] - 1, ps[i - 1] + C[i] - 1)) % MOD;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define db double
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');
    cout.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const ld pi=2*acos(0.0);

ll modi(ll a,ll n){
    ll x=1;
    while(n){
        if(n&1)
            (x*=a)%=MOD;
        (a*=a)%=MOD;
        n>>=1;
    }
    return x;
}

const int NN=(int)1e6+7;

ll fac[NN];

void pre(){
    fac[0]=1;
    rep(i,1,NN)
        (fac[i]=i*fac[i-1])%=MOD;
}

ll nCr(ll a,ll b){
    ll x=fac[a];
    ll y=(fac[b]*fac[a-b])%MOD;
    (x=(x*modi(y,MOD-2)))%=MOD;
    return x;
}

int main(){
    nimble;
    pre();
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,0,n)
        cin>>a[i];
    ll as=1;
    ll N=a[0];
    rep(i,1,n){
        N+=a[i]-1;
        ll prod=nCr(N,a[i]-1);
        (as*=prod)%=MOD;
        N++;
    }
    return cout<<as,0;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
const long long Mod = 1000000007;
long long  fastpower(long long a,long long b)
{
    if(b==0)
        return 1;
    if(b==1)
        return a;
    long long res = fastpower(a,b/2)%Mod;
    res = (res %Mod  * res % Mod )%Mod;
    if(b%2!=0)
        res*=a;
    return res % Mod;
}
long long C(long long a, long long b)
{
    long long p=1,k=1;
    for(int i=a;i>a-b;i--)
    {
        p=((p%Mod)*(i%Mod))%Mod;
    }
    for(int i=b;i>=1;i--)
    {
        k=((k%Mod)*(i%Mod))%Mod;
    }
    return ((p%Mod)*(fastpower(k,Mod-2)))%Mod;
}
int c[1010];
int main()
{
    long long Answer=1,s=0;
    int n,i;  cin>>n;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&c[i]);
        s+=c[i];
    }
    for(i=n-1;i>=0;i--)
    {
        s--;
        c[i]--;
        Answer*=C(s,c[i]);
        s-=c[i];
    }
    cout<<Answer;
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
const long long Mod = 1000000007;
long long  fastpower(long long a,long long b)
{
    if(b==0)
        return 1;
    if(b==1)
        return a;
    long long res = fastpower(a,b/2)%Mod;
    res = (res %Mod  * res % Mod )%Mod;
    if(b%2!=0)
        res*=a;
    return res % Mod;
}
long long C(long long a, long long b)
{
    long long p=1,k=1;
    for(int i=a;i>a-b;i--)
    {
        p=((p%Mod)*(i%Mod))%Mod;
    }
    for(int i=b;i>=1;i--)
    {
        k=((k%Mod)*(i%Mod))%Mod;
    }
    return ((p%Mod)*(fastpower(k,Mod-2)))%Mod;
}
int c[1010];
int main()
{
    long long Answer=1,s=0;
    int n,i;  cin>>n;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&c[i]);
        s+=c[i];
    }
    for(i=n-1;i>=0;i--)
    {
        s--;
        c[i]--;
        Answer=((Answer%Mod)*(C(s,c[i])%Mod))%Mod;
        s-=c[i];
    }
    cout<<Answer;
    return 0;
}


/*
                        ********************
			**  MANAN DIYORA  **
			**    DA-IICT     **
			**   diyora13     **
			********************
*/
#include <bits/stdc++.h>
using namespace std;

//#include <time.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define setpre(x,d) fixed<<setprecision(d)<<x
#define inarr(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define outarr(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl
#define maxa(a,n) *max_element(a,a+n)
#define mina(a,n) *min_element(a,a+n)
#define fr(i,s,e) for(ll i=s;i<e;i++)
#define rf(i,s,e) for(ll i=s-1;i>=e;i--)
#define gcd(a,b) __gcd(a,b)
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define sz size()
#define len length()
#define all(v) v.begin(),v.end()
#define PI 3.141592653589793
#define MOD 1000000007
#define NN (const int)5e5+10

typedef long long int ll;
typedef long double lld;
typedef pair<long long, long long> pll;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;

// bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) { return (a.second < b.second); }
// void fileio()	{	freopen("input.txt","r",stdin);	freopen("output.txt","w",stdout);	}
	vll fact(NN),invfact(NN);
	void EE(ll a,ll b,ll &x,ll &y) {	if(b==0) {	x=1,y=0; return ;	}		EE(b,a%b,x,y);	ll temp=x; x=y; y=temp-(a/b)*y;	}
	ll inverse(ll a,ll mod) 	{	ll x,y;	EE(a,mod,x,y);	return (x+mod)%mod;	}
	void build() { fact[0]=1; fr(i,1,NN) fact[i]=(fact[i-1]*i)%MOD;	invfact[NN-1]=inverse(fact[NN-1],MOD); rf(i,NN-1,0) invfact[i]=(invfact[i+1]*(i+1))%MOD; }
	ll ncr(ll n,ll r)       	{	if(n<0 || r<0 || r>n) return 0;	return (fact[n]*((invfact[n-r]*invfact[r])%MOD))%MOD;	}
	ll choose(ll n,ll k) 	  	{	if(k==0)  return 1; return (n* choose(n-1,k-1))/k;	}
ll logy(ll x,ll y)	{	return ceil((lld)(log(x)/log(y)));	}
ll powe(ll a,ll b)	{	ll re=1;	while(b){	if(b&1) re=(re*a);	a=(a*a);	b=b>>1;}	return re;	}

bool flag=0,flag1=0,flag2=0;

int main()
{
	IOS
	ll t=1;
//	   cin>>t;
	while(t--)
	{
		build();
		ll n; cin>>n;
		ll a[n],ans=1,s=0; inarr(a,n);
		fr(i,0,n)
		{
			s+=a[i];
			ans*=(ncr(s-1,a[i]-1));
			ans%=MOD;
//			cout<<ans<<endl;
		}
		cout<<ans;
	}
	return 0;
}


/*
                        ********************
			**  MANAN DIYORA  **
			**    DA-IICT     **
			**   diyora13     **
			********************
*/
#include <bits/stdc++.h>
using namespace std;

//#include <time.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define setpre(x,d) fixed<<setprecision(d)<<x
#define inarr(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define outarr(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl
#define maxa(a,n) *max_element(a,a+n)
#define mina(a,n) *min_element(a,a+n)
#define fr(i,s,e) for(ll i=s;i<e;i++)
#define rf(i,s,e) for(ll i=s-1;i>=e;i--)
#define gcd(a,b) __gcd(a,b)
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define sz size()
#define len length()
#define all(v) v.begin(),v.end()
#define PI 3.141592653589793
#define MOD 1000000007
#define NN (const int)5e5+10

typedef long long int ll;
typedef long double lld;
typedef pair<long long, long long> pll;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;

// bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) { return (a.second < b.second); }
// void fileio()	{	freopen("input.txt","r",stdin);	freopen("output.txt","w",stdout);	}
	vll fact(NN),invfact(NN);
	void EE(ll a,ll b,ll &x,ll &y) {	if(b==0) {	x=1,y=0; return ;	}		EE(b,a%b,x,y);	ll temp=x; x=y; y=temp-(a/b)*y;	}
	ll inverse(ll a,ll mod) 	{	ll x,y;	EE(a,mod,x,y);	return (x+mod)%mod;	}
	void build() { fact[0]=1; fr(i,1,NN) fact[i]=(fact[i-1]*i)%MOD;	invfact[NN-1]=inverse(fact[NN-1],MOD); rf(i,NN-1,0) invfact[i]=(invfact[i+1]*(i+1))%MOD; }
	ll ncr(ll n,ll r)       	{	if(n<0 || r<0 || r>n) return 0;	return (fact[n]*((invfact[n-r]*invfact[r])%MOD))%MOD;	}
	ll choose(ll n,ll k) 	  	{	if(k==0)  return 1; return (n* choose(n-1,k-1))/k;	}
ll logy(ll x,ll y)	{	return ceil((lld)(log(x)/log(y)));	}
ll powe(ll a,ll b)	{	ll re=1;	while(b){	if(b&1) re=(re*a);	a=(a*a);	b=b>>1;}	return re;	}

bool flag=0,flag1=0,flag2=0;

int main()
{
	IOS
	ll t=1;
//	   cin>>t;
	while(t--)
	{
		build();
		ll n; cin>>n;
		ll a[n],ans=1,s=0; inarr(a,n);
		fr(i,0,n)
		{
			s+=a[i];
			ans*=(ncr(s-1,a[i]-1));
			ans%=MOD;
			cout<<ans<<endl;
		}
//		cout<<ans;
	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.first()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
typedef long long ll;
const ll mod = 1e9 + 7;
ll fact[1005],inv_fact[1005];

ll fp(ll a ,ll p)
{
    if(!p) return 1;
    ll ret = fp(a,p>>1);
    ret = (ret*ret)%mod;
    if(p&1)ret = (ret*a)%mod;
    return ret;
}
ll inv(ll a)
{
    /// a/b %m = a * inv(b) = a * b^(m-2)
    /// inv(a) = a^(mod-2) - only if mod is prime.
    return fp(a,mod-2);
}
ll C(ll a ,ll b)
{
    if(a < 0 || b < 0 || b > a)return 0;
    return (fact[a] * ((inv_fact[b] * inv_fact[a-b])%mod))%mod;
}
int main()
{
    fact[0] = inv_fact[0] = 1;
    for(ll i = 1 ; i < 1004 ; i++) fact[i] = (fact[i-1]*i)%mod , inv_fact[i] = inv(fact[i]);

    int k;
    cin >> k;
    ll sum = 0,ans = 1;
    for(int i = 0 ; i < k ; i++)
    {
        int c;  cin>>c;
        ans *= C(sum + c-1,c-1);
        if(ans >= mod) ans -= mod;
        sum += c;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.first()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
typedef long long ll;
const ll mod = 1e9 + 7;
ll fact[1005],inv_fact[1005];

ll fp(ll a ,ll p)
{
    if(!p) return 1;
    ll ret = fp(a,p>>1);
    ret = (ret*ret)%mod;
    if(p&1)ret = (ret*a)%mod;
    return ret;
}
ll inv(ll a)
{
    /// a/b %m = a * inv(b) = a * b^(m-2)
    /// inv(a) = a^(mod-2) - only if mod is prime.
    return fp(a,mod-2);
}
ll C(ll a ,ll b)
{
    if(a < 0 || b < 0 || b > a)return 0;
    return (fact[a] * ((inv_fact[b] * inv_fact[a-b])%mod))%mod;
}
int main()
{
    fact[0] = inv_fact[0] = 1;
    for(ll i = 1 ; i < 1004 ; i++) fact[i] = (fact[i-1]*i)%mod , inv_fact[i] = inv(fact[i]);

    int k;
    cin >> k;
    ll sum = 0,ans = 1;
    for(int i = 0 ; i < k ; i++)
    {
        int c;  cin>>c;
        ans = (ans*C(sum + c-1,c-1))%mod;
        sum += c;
    }
    cout << ans << '\n';
    return 0;
}


//In Queue of chasing a Dream

#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,A,B) for(int i=A;i<=B;i++)
#define mod (1000*1000*1000+7)
#define v1d vector<int>
#define v1c vector<char>
#define v2d vector<vector<int>>
#define v1s vector<string>
#define vip vector<pair<int,int> >
#define v2s vector<vector<string> >
#define vsp vector<pair<string,string> >
#define pa pair<int,int>

int32_t main(){
    IOS;
    int n,k;cin>>k;
    v1d c(k+1),cum(k+1,0);
    for(int i=1;i<=k;i++){
        cin>>c[i];
        cum[i]= cum[i-1]+c[i];
    }
    n= cum[k];
    v2d ncr(n+1,v1d(k+1));
    for(int i=0;i<=n;i++){
        for(int j=0;j<=min(i,k);j++){
            if(j==0||j==i)
                ncr[i][j]= 1;
            else
                ncr[i][j]= ncr[i-1][j-1]+ncr[i-1][j];
            ncr[i][j]%= mod;
        }
    }
    v1d dp(k+1,1);
    for(int i=1;i<=k;i++){
        dp[i]= ncr[cum[i]-1][c[i]-1];
        dp[i]*= dp[i-1];
        dp[i]%= mod;
    }
    cout<<dp[k];

    return 0;
}


//In Queue of chasing a Dream

#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,A,B) for(int i=A;i<=B;i++)
#define mod (1000*1000*1000+7)
#define v1d vector<int>
#define v1c vector<char>
#define v2d vector<vector<int>>
#define v1s vector<string>
#define vip vector<pair<int,int> >
#define v2s vector<vector<string> >
#define vsp vector<pair<string,string> >
#define pa pair<int,int>

int32_t main(){
    IOS;
    int n,k;cin>>k;
    v1d c(k+1),cum(k+1,0);
    for(int i=1;i<=k;i++){
        cin>>c[i];
        cum[i]= cum[i-1]+c[i];
    }
    n= cum[k];
    v2d ncr(n+1,v1d(n+1));
    for(int i=0;i<=n;i++){
        for(int j=0;j<=min(i,n);j++){
            if(j==0||j==i)
                ncr[i][j]= 1;
            else
                ncr[i][j]= ncr[i-1][j-1]+ncr[i-1][j];
            ncr[i][j]%= mod;
            //cout<<ncr[i][j]<<" ";
        }//cout<<endl;
    }
    v1d dp(k+1,1);
    dp[1]= 1;
    for(int i=1;i<=k;i++){
        dp[i]= ncr[cum[i]-1][c[i]-1];
        //cout<<dp[i]<<" "<<cum[i]<<" "<<c[i]<<endl;
        dp[i]*= dp[i-1];
        dp[i]%= mod;
    }
    cout<<dp[k];

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<int,int>
#define ll long long int
const ll mod=1e9+7;
ll c[1001][1001];
void build(){
    fr(j,1,1001)
    c[j][j]=1;
    fr(i,1,1001)
    c[i][0]=1;
    fr(i,2,1001)
    fr(j,1,i)
    c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    build();
    int n;
    cin>>n;
    int a[n];
    fr(i,0,n)
    cin>>a[i];
    int pre[n];
    pre[0]=a[0];
    fr(i,1,n)
    pre[i]=a[i]+pre[i-1];
    ll dp[n];
    dp[0]=1;
    fr(i,1,n){
        dp[i]=(dp[i-1]*c[pre[i]-1][a[i]-1])%mod;
    }
    cout<<dp[n-1];
}


#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define MOD 1000000007
ll c[1005][1005];
void ncr()
{c[0][0]=1;
	for(int i=1;i<=1000;i++)
	{
		c[i][0]=1;
		c[i][i]=1;
		for(int j=1;j<i;j++)
		{
			c[i][j]=(c[i-1][j]+c[i-1][j-1])%MOD;
		}
	}
}

int main()
{ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t,m;ll ct=0,ans=1;
cin>>t;
ncr();
while(t--)
{
cin>>m;
ans=(ans*c[ct+m-1][m-1])%MOD;
ct+=m;
}
cout<<ans%MOD;
return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define MOD 1000000007

ll ncr(int n,int r)
{
if(n<r) return 0;
r=min(r,n-r);
double ans=1;

for(int i=0;i<r;i++) ans=ans*(n-i)/(i+1);
return ((ll(ans))%MOD);
}

int main()
{ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t,m;ll ct=0,ans=1;
cin>>t;
while(t--)
{
cin>>m;
ans=(ans*ncr(ct+m-1,m-1))%MOD;
ct+=m;
}
cout<<ans%MOD;
return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;
#define int long long
ll mult[2100];
ll divi[2100];
vector<int> primes;

int prdiv(int a){
    for(int i = 0; i < primes.size(); ++i){
        if(a % primes[i] == 0){
            a/= primes[i];
            divi[i]++;
            i--;
        }
    }
}
int prmult(int a){
    for(int i = 0; i < primes.size(); ++i){
        if(a % primes[i] == 0){
            a/= primes[i];
            mult[i]++;
            i--;
        }
    }
}
#undef int long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #define int long long
    int k;
    cin>> k;
    for(int i = 2; i < 10000; ++i){
        for(int j = 2; j <= i; ++j){
            if(i!= j)
            if(i%j == 0) break;
            if(j == i) primes.push_back(i);
        }
    }
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long ans = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            prmult(sum+j);
            prdiv(j);
        }
        sum+=arr[i];
    }
    for(int i = 0; i < primes.size(); ++i){
        int aa = min(mult[i], divi[i]);
        mult[i] -= aa;
        for(int j = 0; j < mult[i]; ++j){
            ans *= primes[i];
            cout<<ans <<endl;
            ans%= 1000000007;
        }
    }

    ans%=1000000007;
    cout<<ans<<endl;
    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #define int long long
    int k;
    cin>> k;
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long a = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            a *= sum+j;
            a /= j;
            a%= 1000000007;
        }
        sum+=arr[i];
    }
    a%=1000000007;
    cout<<a<<endl;
    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #define int long long
    int k;
    cin>> k;
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long a = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            a *= sum+j;
            a /= j;
        }
        sum+=arr[i];
        a%=1000000007;
    }
    cout<<a<<endl;
    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #define int long long
    int k;
    cin>> k;
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long a = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            a *= sum+j;
            a /= j;
            a%= 100000000000;
        }
        sum+=arr[i];
    }
    a%=1000000007;
    cout<<a<<endl;
    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;
#define int long long
ll mult[2100];
ll divi[2100];
vector<int> primes;

int prdiv(int a){
    for(int i = 0; i < primes.size(); ++i){
        if(a % primes[i] == 0){
            a/= primes[i];
            divi[i]++;
            i--;
        }
    }
}
int prmult(int a){
    for(int i = 0; i < primes.size(); ++i){
        if(a % primes[i] == 0){
            a/= primes[i];
            mult[i]++;
            i--;
        }
    }
}
#undef int long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #define int long long
    int k;
    cin>> k;
    for(int i = 2; i < 10000; ++i){
        for(int j = 2; j <= i; ++j){
            if(i!= j)
            if(i%j == 0) break;
            if(j == i) primes.push_back(i);
        }
    }
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long ans = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            prmult(sum+j);
            prdiv(j);
        }
        sum+=arr[i];
    }
    for(int i = 0; i < primes.size(); ++i){
        int aa = min(mult[i], divi[i]);
        mult[i] -= aa;
        for(int j = 0; j < mult[i]; ++j){
            ans *= primes[i];
            ans%= 1000000007;
        }
    }

    ans%=1000000007;
    cout<<ans<<endl;
    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #define int long long
    int k;
    cin>> k;
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long a = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            a *= sum+j;
            a /= j;
            a%= 100000000000;
        }
        a*= arr[i];
        sum+=arr[i];
    }
    a%=1000000007;
    cout<<a<<endl;
    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int k;
    cin>> k;
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long a = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            a *= sum+j;
            a /= j;
        }
        sum+=arr[i];
        a%=1000000007;
    }
    cout<<a<<endl;
    return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O4")
#include<bits/stdc++.h>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define x first
#define y second
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #define int long long
    int k;
    cin>> k;
    #define n k
    int arr[k+1];
    for(int i = 0; i < k; ++i){
        cin>>arr[i];
    }
    long long a = 1;
    ll sum = arr[0];
    for(int i = 1; i < n; ++i){
        for(int j = 1; j < arr[i]; ++j){
            a *= sum+j;
            a /= j;
            a%=1000000007;
        }
        sum+=arr[i];
        a%=1000000007;
    }
    cout<<a<<endl;
    return 0;
}


//#defined
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define push push_back
#define pop pop_back
#define it vector<ll>::iterator

ll nCrModpDP(ll n, ll r, ll p)
{
    ll C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, r); j > 0; j--)

            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

ll nCrModpLucas(ll n, ll r, ll p)
{
   if (r==0)
      return 1;
   ll ni = n%p, ri = r%p;
   return (nCrModpLucas(n/p, r/p, p) *
           nCrModpDP(ni, ri, p)) % p;
}

int main() {
    ll k;
    cin>>k;
    ll a[k];
    ll n=0;
    for(ll i=0;i<k;i++)
    {
        cin>>a[i];
        n+=a[i];
    }
    ll count=1;
    for(ll i=k-1;i>=0;i--)
    {
        n-=1;
        ll fill=a[i]-1;
        ll ans=nCrModpLucas(n,fill,1000000007);
        ans%=1000000007;
        n-=fill;
        if(ans)
        count*=ans;
        count%=1000000007;
    }
    cout<<count;

    return 0;
}


#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include <cstring>
#include <iomanip>
#include <algorithm>
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

//const double PI  = acos(-1.0);
using namespace std;
//typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
//typedef complex<double> point;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//char rv[4]={'D','R','L','U'};
const double EPS = 1e-9;

ll mod = 1000000007;
int MAXN = 1010;
ll comb[1020][1020] ;
const int N = 5e6 + 9;
ll k,n,a[1009],mem[1009][1009],m=1e9+7;

ll dp(int i,int p)
{
    if(i==0)return 1;
    if(p==0)return 0;
    ll&ret=mem[i][p];
    if(~ret)return ret;
    ret=dp(i,p-1)%m;
    if(a[i]<=p)
    {
        ret+=((dp(i-1,p-a[i]+a[i-1])%m)*comb[p-1][a[i]-a[i-1]-1])%m;
        ret%=m;
    }
    return ret;
}

 int main()
{
//freopen("circles.in ","r",stdin);
//freopen("circles.out","w",stdout);
//__builtin_popcount()
input
    comb[0][0] = 1;
    for (int i = 1; i < MAXN; i++) {
    comb[i][0] = 1;
    for (int j = 1; j <= i; j++) {
        comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % mod;
      }
    }
        cin>>k;
        forr(i,1,k)
        {
            cin>>a[i];
            a[i]+=a[i-1];
        }
        n=a[k];
        memset(mem,-1,sizeof mem);
        cout<<(dp(k,n)+m+m)%m;

return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
inline ll input(){ll n; cin >> n ; return n;}
ll pw(ll a , ll b)  { return (!b ? 1 : (b & 1 ? a * pw(a * a , b / 2) : pw(a * a , b / 2))); }

const ll MAXN = 1010 , MOD = 1e9 + 7;
ll n , ans = 1 , sum , p[MAXN] , c[MAXN][MAXN];

int main()
{
    fast_io;  /** if you sure yuor code is true but get TLE use scanf and printf*/

    c[0][0] = 1;
    for(ll i = 1 ; i < MAXN ; i++)
    {
        c[i][0] = 1;
        for(ll j = 1 ; j < MAXN ; j++)
        {
            c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
        }
    }

    cin >> n;
    for(ll i = 0 ; i < n ; i++)
    {
        cin >> p[i];
        sum += p[i];
        ans = (ans * c[sum - 1][p[i] - 1]) % MOD;
    }
    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define lld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define cases ll T=0;cin>>T;while(T--)
#define ain(a,n) for(i=0;i<(n);i++) cin>>(a)[i];
#define aout(a,n) for(i=0;i<(n);i++) cout<<(a)[i]<<" ";
#define all(v) (v).begin(),(v).end()
#define ED cout<<"\n";
#define pb push_back
#define mp make_pair
#define inf 9e18
#define MOD 1000000007
#define ff first
#define ss second

using namespace std;

ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

ll modinverse(ll a, ll m)
{
    return power(a, m - 2, m);
}

vll f(1005, 1);

void pre()
{
    ll i = 0;
    for (i = 1; i < 1005; i++)
    {
        f[i] = ((f[i - 1] % MOD) * (i % MOD)) % MOD;
    }
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    fast;
    pre();
    //cases
    {
        ll n = 0, i = 0;
        cin >> n;
        vll c(n);
        ain(c, n);
        ll ans = 1;

        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            ans = ((ans % MOD) * (f[sum + c[i] - 1] % MOD)) % MOD;
            ans = ((ans % MOD) * (modinverse(f[sum], MOD) % MOD)) % MOD;
            ans = ((ans % MOD) * (modinverse(f[c[i] - 1], MOD) % MOD)) % MOD;
            sum += c[i];
        }
        cout << ans;
        ED;
    }

    return 0;
}


#include<bits/stdc++.h>
#define ll long long
const int mod = 1e9 + 7;
const int NMAX = 1e3+1;
using namespace std;
ll pw(ll x,ll p){
	if(p == 1)return x%mod;
	ll y = pw(x,p/2);
	return  ( ((y*y)%mod) * (p%2 ? x%mod : 1LL ))%mod;
}
ll inv(ll x){
	return pw(x,mod-2);
}
int main(){
	int k;scanf("%d",&k);
	int fact[NMAX];
	fact[0] = fact[1] = 1;
	for(int i = 2;i<NMAX;i++)fact[i] = (fact[i-1] * i)%mod;
	vector<ll> c(k);
	for(int i = 0;i<k;i++)scanf("%d",&c[i]);
	ll n = c[0], ans = 1;
	for(int i = 1;i<k;i++){
		ans = (ans * fact[n+c[i] -1])%mod;
		ans = (ans * inv(fact[n]))%mod;
		ans = (ans * inv(fact[c[i]-1]))%mod;
		n+=c[i];
	}
	printf("%lld\n",ans);

}


#include<bits/stdc++.h>
#define ll long long
const int mod = 1e9 + 7;
const int NMAX = 1e3+1;
using namespace std;
ll pw(ll x,ll p){
	if(p == 1)return x%mod;
	ll y = pw(x,p/2);
	return  ( ((y*y)%mod) * (p%2 ? x%mod : 1LL ))%mod;
}
ll inv(ll x){
	return pw(x,mod-2);
}
int main(){
	int k;scanf("%d",&k);
	int fact[NMAX];
	fact[0] = fact[1] = 1;
	for(ll i = 2;i<NMAX;i++)fact[i] = (fact[i-1] * i)%mod;
	vector<ll> c(k);
	for(int i = 0;i<k;i++)scanf("%d",&c[i]);
	ll n = c[0], ans = 1;
	for(int i = 1;i<k;i++){
		ans = (ans * fact[n+c[i] -1])%mod;
		ans = (ans * inv(fact[n]))%mod;
		ans = (ans * inv(fact[c[i]-1]))%mod;
		n+=c[i];
	}
	printf("%lld\n",ans);

}


#include <bits/stdc++.h>

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

const int M = 1e9 + 7;

int fact (int n) {
	int res = 1;
	for (int i = 2; i <= n; ++i)
			res = (long long)res * i % M;
	return res;
}

int power (int a, int b) {
	if (b == 0)
			return 1;
	else {
		if (b % 2 == 1)
			return (long long)a * power(a, b - 1) % M;
		else return power((long long)a * a % M, b / 2) % M;
	}
}

int cnk (int n, int k) {
	if (k == 0 || n == 0) return 1;
	else {
		int ch = fact(n);
		int zn = (long long)fact(k) * fact(n - k) % M;
		return (long long)ch * power(zn, M - 2) % M;
	}
}

int main()
{
  IO;
 	int k; cin >> k;
	int sum = 0;
	cin >> sum;
	int res = 1;
	for (int i = 1; i < k; ++i) {
		int c; cin >> c;
		res = (long long)res * cnk(sum + c - 1, c - 1) % M;
		sum += c;
	}
	cout << res << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;

#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr)
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll modinv(ll n)    { ll ans=powm(n,mod-2); return ans; }
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

const int nax = 1005;
ll fact[nax],inv[nax];

void pre()
{
	fact[0]=1;
	forn(i,1,nax)
		fact[i]=mult(fact[i-1],i);

	inv[nax-1]=modinv(fact[nax-1]);
	//error(inv[nax-1]);
	for(ll i=nax-2;i>=0;i--)
		inv[i]=mult(inv[i+1],i+1);
}

ll ncr(ll n,ll r)
{
	if(n<r)
		return 0;

	//error(fact[n],inv[n-r],inv[r]);
	ll ans=mult(fact[n],inv[r]);
	ans=mult(ans,inv[n-r]);
	//cout<<ans<<endl;
	return ans;
}

int main()
{
	fast

	pre();
	ll k;
	cin>>k;

	ll ans=1;
	ll sum=0;
    forn(i,0,k)
    {
    	ll n;
    	cin>>n;

    	ans=mult(ans,ncr(sum+n-1,n-1));
    	sum+=n;
    }

	cout<<ans;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;

#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr)
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll modinv(ll n)    { ll ans=powm(n,mod-2); return ans; }
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

const int nax = 1005;
ll fact[nax],inv[nax];

void pre()
{
	fact[0]=1;
	forn(i,1,nax)
		fact[i]=mult(fact[i-1],i);

	inv[nax-1]=modinv(fact[nax-1]);
	//error(inv[nax-1]);
	for(ll i=nax-2;i>=0;i--)
		inv[i]=mult(inv[i+1],i+1);
}

ll ncr(ll n,ll r)
{
	if(n<r)
		return 0;

	//error(fact[n],inv[n-r],inv[r]);
	ll ans=mult(fact[n],inv[r]);
	ans=mult(ans,inv[n-r]);
	//cout<<ans<<endl;
	return ans;
}

int main()
{
	fast

	pre();
	ll k;
	cin>>k;

	ll ans=1;
	ll sum=0;
	forn(i,0,k)
	{
    	ll n;
    	cin>>n;

    	ans=mult(ans,ncr(sum+n-1,n-1));
    	sum+=n;
	}

	cout<<ans;

	return 0;
}


#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define int long long
#define szof(s) (int)s.size()
using namespace std;

const int N = 200005;
const int INF = (int)1e9 + 9;
const int MOD = (int)1e9 + 7;
int f[N], dp[N];

void go(int x) {
	cout << x;
	exit(0);
}

int pw(int a, int b) {
	if (b == 0) {
		return 1;
	}
	if (b % 2 == 0) {
		int x = pw(a, b / 2) % MOD;
		return (x * x) % MOD;
	}
	else {
		return (pw(a, b - 1) % MOD) * a % MOD;
	}
}

// Read problem and understand it 100%
// Make observation
// SOLVE THE PROBLEM

main() {
	int n, pref = 0;
	cin >> n;
	f[0] = 1;
	for (int i = 1; i <= N - 123; i++) {
		f[i] = (f[i - 1] * i) % MOD;
	}

	int res = 1;
	for (int i = 1; i <= n; i++) {
		int k;
		cin >> k;
		int a = pw(f[k - 1], MOD - 2) % MOD;
		int b = pw(f[pref], MOD - 2) % MOD;
		res *= f[pref + k - 1] * ((a * b) % MOD);
		res %= MOD;
		pref += k;
	}
	cout << res << endl;
}


#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define int long long
#define szof(s) (int)s.size()
using namespace std;

const int N = 200005;
const int INF = (int)1e9 + 9;
const int MOD = (int)1e9 + 7;
int f[N], dp[N];

void go(int x) {
	cout << x;
	exit(0);
}

int pw(int a, int b) {
	if (b == 0) {
		return 1;
	}
	if (b % 2 == 0) {
		int x = pw(a, b / 2) % MOD;
		return (x * x) % MOD;
	}
	else {
		return (pw(a, b - 1) % MOD) * a % MOD;
	}
}

// Read problem and understand it 100%
// Make observation
// SOLVE THE PROBLEM

main() {
	int n, pref = 0;
	cin >> n;
	f[0] = 1;
	for (int i = 1; i <= N - 123; i++) {
		f[i] = (f[i - 1] * i) % MOD;
	}

	int res = 1;
	for (int i = 1; i <= n; i++) {
		int k;
		cin >> k;
		res *= f[pref + k - 1] * (pw(f[k - 1], MOD - 2) % MOD * pw(f[pref], MOD - 2) % MOD) % MOD;
		res %= MOD;
		pref += k;
	}
	cout << res << endl;
}


#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define int long long
#define szof(s) (int)s.size()
using namespace std;

const int N = 200005;
const int INF = (int)1e9 + 9;
const int MOD = (int)1e9 + 7;
int f[N], dp[N];

void go(int x) {
	cout << x;
	exit(0);
}

int pw(int a, int b) {
	if (b == 0) {
		return 1;
	}
	if (b % 2 == 0) {
		int x = pw(a, b / 2) % MOD;
		return (x * x) % MOD;
	}
	else {
		return (pw(a, b - 1) % MOD) * a % MOD;
	}
}

// Read problem and understand it 100%
// Make observation
// SOLVE THE PROBLEM

main() {
	int n, pref = 0;
	cin >> n;
	f[0] = 1;
	for (int i = 1; i <= N - 123; i++) {
		f[i] = (f[i - 1] * i) % MOD;
	}

	int res = 1;
	for (int i = 1; i <= n; i++) {
		int k;
		cin >> k;
		int a = pw(f[k - 1], MOD - 2) % MOD;
		int b = pw(f[pref], MOD - 2) % MOD;
		res *= (f[pref + k - 1] * ((a * b) % MOD)) % MOD;
		res %= MOD;
		pref += k;
	}
	cout << res << endl;
}


#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define int long long
#define szof(s) (int)s.size()
using namespace std;

const int N = 200005;
const int INF = (int)1e9 + 9;
const int MOD = (int)1e9 + 7;
int f[N], dp[N];

void go(int x) {
	cout << x;
	exit(0);
}

int pw(int a, int b) {
	if (b == 0) {
		return 1;
	}
	if (b % 2 == 0) {
		int x = pw(a, b / 2) % MOD;
		return (x * x) % MOD;
	}
	else {
		return (pw(a, b - 1) % MOD) * a % MOD;
	}
}

// Read problem and understand it 100%
// Make observation
// SOLVE THE PROBLEM

main() {
	int n, pref = 0;
	cin >> n;
	f[0] = 1;
	for (int i = 1; i <= N - 123; i++) {
		f[i] = (f[i - 1] * i) % MOD;
	}

	int res = 1;
	for (int i = 1; i <= n; i++) {
		int k;
		cin >> k;
		res *= f[pref + k - 1] * (pw(f[k - 1], MOD - 2) % MOD * pw(f[pref], MOD - 2) % MOD);
		res %= MOD;
		pref += k;
	}
	cout << res << endl;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<set>
#include<cmath>
#define ll long long
using namespace std;
ll dp[1005];
ll a[1005];
ll sum[1005];
const int maxn =1000005;
const ll mod = 1000000007;
ll Jc[maxn];

void calJc()	//求maxn以内的数的阶乘
{
    Jc[0] = Jc[1] = 1;
    for(ll i = 2; i < maxn; i++)
        Jc[i] = Jc[i - 1] * i % mod;
}

//费马小定理求逆元
ll pow(ll a, ll n, ll p)	//快速幂 a^n % p
{
    ll ans = 1;
    while(n)
    {
        if(n & 1) ans = ans * a % p;
        a = a * a % p;
        n >>= 1;
    }
    return ans;
}

ll niYuan(ll a, ll b)	//费马小定理求逆元
{
    return pow(a, b - 2, b);
}

ll C(ll a, ll b)	//计算C(a, b)
{
    if(a < b) return 0;
    return Jc[a] * niYuan(Jc[b], mod) % mod
        * niYuan(Jc[a - b], mod) % mod;
}
ll cal(int i){
	ll n = sum[i-1]+1;
	ll m = a[i]-1;
//	cout<<n<<" "<<m<<"\n";
	if(m<=0){
		return 1;
	}
	ll ans=0;
	for(ll i=1;i<=m;i++){
	//	cout<<n<<" "<<i<<" "<<C(3, 1)<<"\n";
		ans=(ans+((C(n, i)*C(m-1, i-1))%mod))%mod;
	}
	//cout<<ans<<"\n";
	return ans;
}
int main(){
	//freopen("in.txt","r",stdin);
	calJc();
//	cout<<C(3, 1);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
	}
	dp[1]=1;sum[1]=a[1];
	for(int i=2;i<=n;i++){
		dp[i]=(dp[i-1]*cal(i))%mod;
		sum[i]=sum[i-1]+a[i];
	}
//	for(int i=1;i<=n;i++)cout<<dp[i]<<" ";
//	cout<<"\n";
	printf("%lld",dp[n]);
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int MOD = 1e9 + 7;
const int N = 1001;

ll fact[N], f[N], pre[N];

ll bin_exp(ll a, ll b) {
    a %= MOD;
    ll res = 1;
    while (b > 0) {
        if (b & 1) {
            res *= a;
            res %= MOD;
        }
        a *= a;
        a %= MOD;
        b >>= 1;
    }
    return res;
}

ll inv_mod(ll x) {
    return bin_exp(x, MOD - 2);
}

int c(int n, int k) {
    ll den = (fact[n - k] * fact[k]) % MOD;
    return (fact[n] * inv_mod(den)) % MOD;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    fact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = (fact[i - 1] * i) % MOD;
    }
    int k;
    cin >> k;
    vector<int> color(k + 1);
    for (int i = 1; i <= k; i++) {
        cin >> color[i];
        pre[i] = pre[i - 1] + color[i];
    }
    f[1] = 1;
    for (int i = 2; i <= k; i++) {
        f[i] = (f[i - 1] * c(pre[i] - 1, color[i] - 1)) % MOD;
    }
    cout << f[k];
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int MOD = 1e9 + 7;
const int N = 1001;

ll fact[N], f[N], pre[N];

ll bin_exp(ll a, ll b) {
    a %= MOD;
    ll res = 1;
    while (b > 0) {
        if (b & 1) {
            res *= a;
            res %= MOD;
        }
        a *= a;
        a %= MOD;
        b >>= 1;
    }
    return res;
}

ll inv_mod(ll x) {
    return bin_exp(x, MOD - 2);
}

int c(int n, int k) {
    ll den = (fact[n - k] * fact[k]) % MOD;
    return (fact[n] * inv_mod(den)) % MOD;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    fact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = (fact[i - 1] * i) % MOD;
    }
    int k;
    cin >> k;
    vector<int> color(k + 1);
    for (int i = 1; i <= k; i++) {
        cin >> color[i];
        pre[i] = pre[i - 1] + color[i];
    }
    f[1] = 1;
    for (int i = 2; i <= k; i++) {
        // c(n + k - 1, k) see the handbook
        f[i] = (f[i - 1] * c((pre[i - 1] + 1) + (color[i] - 1) - 1, color[i] - 1)) % MOD;
    }
    cout << f[k];
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define f(a) for (ll i = 0; i < a; i++)
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
int nCrModpDP(int n, int r, int p)
{
    // The array C is going to store last row of
    // pascal triangle at the end. And last entry
    // of last row is nCr
    int C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1; // Top row of Pascal Triangle

    // One by constructs remaining rows of Pascal
    // Triangle from top to bottom
    for (int i = 1; i <= n; i++)
    {
        // Fill entries of current row using previous
        // row values
        for (int j = min(i, r); j > 0; j--)

            // nCj = (n-1)Cj + (n-1)C(j-1);
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

// Lucas Theorem based function that returns nCr % p
// This function works like decimal to binary conversion
// recursive function.  First we compute last digits of
// n and r in base p, then recur for remaining digits
int nCrModpLucas(int n, int r, int p)
{
   // Base case
   if (r==0)
      return 1;

   // Compute last digits of n and r in base p
   int ni = n%p, ri = r%p;

   // Compute result for last digits computed above, and
   // for remaining digits.  Multiply the two results and
   // compute the result of multiplication in modulo p.
   return (nCrModpLucas(n/p, r/p, p) * // Last digits of n and r
           nCrModpDP(ni, ri, p)) % p;  // Remaining digits
}

int main()
{
    ll n;
    cin>>n;
    ll ar[n];
    ll dp[n];
    ll sum[n];
    f(n){sum[i]=0;dp[i]=0;}
    f(n){cin>>ar[i];if(i==0){sum[i]=ar[0];}else{sum[i]=sum[i-1]+ar[i];}}
    dp[0]=1;

    for(ll i=1;i<n;i++)
    {

        if(ar[i]==1){dp[i]=dp[i-1];}
        else{ll z=1;
             z=nCrModpLucas(sum[i]-1,sum[i-1],1000000007);
            dp[i]=(z*dp[i-1])%1000000007;
            //cout<<z<<endl<<"----------------------"<<endl;

        }
    }

    cout<<dp[n-1];

    return 0;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define f(a) for (ll i = 0; i < a; i++)
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

ll ncr(ll n, ll r)
{
    ll z=1;
    ll j=1;
    for(ll i=n;i>max(n-r,r);i--)
    {
        z=(z*i)/j;
        j++;
    }
    return z;
}

int main()
{
    int n;
    cin>>n;
    ll ar[n];
    ll dp[n];
    ll sum[n];
    f(n){sum[i]=0;dp[i]=0;}
    f(n){cin>>ar[i];if(i==0){sum[i]=ar[0];}else{sum[i]=sum[i-1]+ar[i];}}
    dp[0]=1;
    for(ll i=1;i<n;i++)
    {

        if(ar[i]==1){dp[i]=dp[i-1];}
        else{ll z=1;
             z=ncr(sum[i]-1,sum[i-1]);
            dp[i]=z*dp[i-1];

        }
    }
     f(n){cout<<dp[i]<<endl;}
     cout<<dp[n-1]%1000000007;
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define f(a) for (ll i = 0; i < a; i++)
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
int fact(int n);

int ncr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}

int main()
{
    int n;
    cin>>n;
    int ar[n];
    int dp[n];
    int sum[n];
    f(n){sum[i]=0;dp[i]=0;}
    f(n){cin>>ar[i];if(i==0){sum[i]=ar[0];}else{sum[i]=sum[i-1]+ar[i];}}
    dp[0]=1;
    for(int i=1;i<n;i++)
    {
        if(ar[i]==1){dp[i]=dp[i-1];}
        else{
            dp[i]=(ncr(sum[i-1]+1,ar[i]-1))*dp[i-1];

        }
    }
   // f(n){cout<<dp[i]<<endl;}
     cout<<dp[n-1];
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define f(a) for (ll i = 0; i < a; i++)
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

__int64 ncr(ll n, ll r)
{
    ll z=1;
    ll j=1;
    for(ll i=n;i>max(n-r,r);i--)
    {
        z=(z*i)/j;
        j++;
    }
    return z;
}

int main()
{
    int n;
    cin>>n;
    ll ar[n];
    ll dp[n];
    ll sum[n];
    f(n){sum[i]=0;dp[i]=0;}
    f(n){cin>>ar[i];if(i==0){sum[i]=ar[0];}else{sum[i]=sum[i-1]+ar[i];}}
    dp[0]=1;
    for(ll i=1;i<n;i++)
    {

        if(ar[i]==1){dp[i]=dp[i-1];}
        else{ll z=1;
             z=ncr(sum[i]-1,sum[i-1]);
            dp[i]=z*dp[i-1];
            //cout<<z<<endl;

        }
    }
  //   f(n){cout<<dp[i]<<endl;}
     cout<<dp[n-1]%1000000007;
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define f(a) for (ll i = 0; i < a; i++)
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
int fact(int n);

int ncr(int n, int r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

// Returns factorial of n
int fact(int n)
{
    int res = 1;
    for (int i = 2; i <= n; i++)
        res = res * i;
    return res;
}
int main()
{
    int n;
    cin>>n;
    int ar[n];
    int dp[n];
    int sum[n];
    f(n){sum[i]=0;dp[i]=0;}
    f(n){cin>>ar[i];if(i==0){sum[i]=ar[0];}else{sum[i]=sum[i-1]+ar[i];}}
    dp[0]=1;
    for(int i=1;i<n;i++)
    {   int z=1;
        int k;
        if(ar[i]==1){dp[i]=dp[i-1];}
        else{int z;
             z=ncr(sum[i]-1,sum[i-1]);
            dp[i]=z*dp[i-1];

        }
    }
   // f(n){cout<<dp[i]<<endl;}
     cout<<dp[n-1]%1000000007;
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define f(a) for (ll i = 0; i < a; i++)
#define fio                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

ll ncr(ll n, ll r)
{
    ll z=1;
    ll j=1;
    for(ll i=n;i>max(n-r,r);i--)
    {
        z=(z*i)/j;
        j++;
    }
    return z;
}

int main()
{
    int n;
    cin>>n;
    ll ar[n];
    ll dp[n];
    ll sum[n];
    f(n){sum[i]=0;dp[i]=0;}
    f(n){cin>>ar[i];if(i==0){sum[i]=ar[0];}else{sum[i]=sum[i-1]+ar[i];}}
    dp[0]=1;
    for(ll i=1;i<n;i++)
    {

        if(ar[i]==1){dp[i]=dp[i-1];}
        else{ll z=1;
             z=ncr(sum[i]-1,sum[i-1]);
            dp[i]=z*dp[i-1];

        }
    }
    // f(n){cout<<dp[i]<<endl;}
     cout<<dp[n-1]%1000000007;
    return 0;

}


#include<iostream>
using namespace std;
#define mod 1000000007
long long int Com[1005][1005];
void com()
{
	for(int i=0;i<=1000;i++)
	{
		Com[i][0]=1;
		for(int j=1;j<=i;j++)
		{
			Com[i][j]=(Com[i-1][j-1]+Com[i-1][j])%mod;
		}
	}
}
int main()
{
	int k;
	com();
	//cout << Com[49][9];
	cin>>k;
	long long int a[k+1],sum[k+1],ans=1;
	sum[0]=0;
	for(int i=1;i<=k;i++)
	{
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
		//cout << f[i] << " " ;
		ans=(ans*Com[sum[i]-1][a[i]-1])%mod;
	}
	ans+=mod;
	ans%=mod;
	cout << ans << endl;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<map>
#include<string>
#include<math.h>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
#define LL long long
#define mod 1000000007
LL C[1005][1005];
int sum[1005];
LL Sech(int n, int m)
{
	if(n==1)
		return 1;
	return C[m-1][sum[n]-1]*Sech(n-1, m-sum[n])%mod;
}
int main(void)
{
	int m, n, i, j;
	for(i=0;i<=1002;i++)
		C[i][0] = 1;
	for(i=1;i<=1002;i++)
	{
		for(j=1;j<=i;j++)
			C[i][j] = (C[i-1][j-1]+C[i-1][j])%mod;
	}
	m = 0;
	scanf("%d", &n);
	for(i=1;i<=n;i++)
	{
		scanf("%d", &sum[i]);
		m += sum[i];
	}
	printf("%lld\n", Sech(n, m));
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 2000 + 10 , N = 2e6 + 10 , SQ = 320 , base = 1999 , mod = 1e9 + 7 , INF = -1e9 , lg = 33;

int k , a[maxn] , dp[maxn] , psum[maxn] , fac[maxn] , inv[maxn];

inline int power(int a , int b) {
    int res = 1;
    while(b) {
        if(b & 1) {
            res = (res * a) % mod;
        }
        b /= 2;
        a = (a * a) % mod;
    }
    return res;
}

inline int C(int a , int b) {
    int res = fac[a];
    res = (res * inv[b]) % mod;
    res = (res * inv[a - b]) % mod;
    return res;
}

int32_t main() {
    FAST
    cin >> k;
    for (int i = 0; i < k; ++i) {
        cin >> a[i];
    }
    fac[0] = 1; inv[0] = 1;
    for (int i = 1; i <= k; ++i) {
        psum[i] = psum[i - 1] + a[i - 1];
    }
    for (int i = 1; i < maxn; ++i) {
        fac[i] = (fac[i - 1] * i) % mod;
        inv[i] = power(fac[i] , mod - 2);
    }
    dp[0] = 1;
    for (int i = 1; i <= k; ++i) {
        int x = psum[i - 1] + 1 , val = a[i - 1] - 1;
        // cout << x + val - 1 << ' ' << x - 1 << ' ' << C(val + x - 1 , x - 1) << ' ' << dp[i] << endl;
        dp[i] = (dp[i - 1] * C(val + x - 1 , x - 1)) % mod;
    }
    cout << dp[k] << '\n';
}


// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
#define sz(x) ll(x.size())
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

const ll mod = 1e9 + 7;
const int inf = 1e9 + 5;
const int N = 1e6 + 5;

ll fact[N],ifact[N],c[1005];

ll power(ll x,ll y){
    ll res=1;
    x%=mod;
    while(y>0){
        if(y & 1)
            res=(res*x)%mod;
        y=y>>1;
        x=(x*x)%mod;
    }
    return res%mod;
}

ll modInv(ll n){
    return power(n,mod-2);
}

ll add(ll a,ll b){
	a%=mod; b%=mod;
	return a+b>=mod?a+b-mod:a+b;
}
ll mul(ll a,ll b){
	a%=mod; b%=mod;
	return (a*b)%mod;
}

ll C(ll n,ll r){
    if(r>n||r<0)
        return 0;
    return mul(fact[n],mul(ifact[r],ifact[n-r]));
}

void precompute(){
    fact[0]=1;
    ifact[0]=1;
    for(int i=1;i<N;++i){
        fact[i]=mul(fact[i-1],i);
        ifact[i]=mul(ifact[i-1],modInv(i));
    }
}

signed main(){
    fastio;
    precompute();
    ll i,k,ans=1,sum;
    cin>>k>>c[1];
    sum=c[1];
    for(i=2;i<=k;++i){
        cin>>c[i];
        ans*=(C(c[i]+sum,sum)-C(c[i]+sum-1,sum-1)+mod);
        ans%=mod;
        sum+=c[i];
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define vc vector<char>
#define vi vector<ll>
#define vl vector<ll>
#define vs vector<string>
#define si unordered_set<ll>
#define pii pair<ll,ll>
#define pbi pair<bool,ll>
#define SORT(c) sort(c.begin(),c.end())
#define SORTC(c, cmp) sort(c.begin(),c.end(),cmp)
#define mapii map<ll,ll>
#define mapll map<ll,ll>
#define pb push_back

using namespace std;

int main() {

    int C[1003][1003];
    const int mod = 1000000007;

    for (int i = 0; i < 1003; ++i) {

        for (int j = 0; j < i+1; ++j) {
            if (i==0 || j==0 || i==j)
                C[i][j]=1;

            else
                C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }

    }

    ll n{};
    cin >> n;
    mapii dp{};
    dp[1] = 1;
    ll sum{};

    for (ll i = 1, x; i <= n; ++i) {
        cin >> x;
        sum += x;
        if (i == 1) continue;
        if (x == 1) {
            dp[i] = dp[i - 1];
            continue;
        }
        dp[i] = C[sum-1][x-1] * dp[i - 1];

    }
    cout << dp[n]<<endl;
}


#include <bits/stdc++.h>

#define ll long long
#define vc vector<char>
#define vi vector<ll>
#define vl vector<ll>
#define vs vector<string>
#define si unordered_set<ll>
#define pii pair<ll,ll>
#define pbi pair<bool,ll>
#define SORT(c) sort(c.begin(),c.end())
#define SORTC(c, cmp) sort(c.begin(),c.end(),cmp)
#define mapii map<ll,ll>
#define mapll map<ll,ll>
#define pb push_back

using namespace std;

int main() {

    int C[1003][1003];
    const int mod = 1000000007;

    for (int i = 0; i < 1003; ++i) {

        for (int j = 0; j < i+1; ++j) {
            if (i==0 || j==0 || i==j)
                C[i][j]=1;

            else
                C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }

    }

    ll n{};
    cin >> n;
    mapii dp{};
    dp[1] = 1;
    ll sum{};

    for (ll i = 1, x; i <= n; ++i) {
        cin >> x;
        sum += x;
        if (i == 1) continue;
        if (x == 1) {
            dp[i] = dp[i - 1];
            continue;
        }
        dp[i] = C[sum-1][x-1] * dp[i - 1];
        dp[i]%=mod;

    }
    cout << dp[n]<<endl;
}


#include <bits/stdc++.h>

#define ll long long
#define vc vector<char>
#define vi vector<ll>
#define vl vector<ll>
#define vs vector<string>
#define si unordered_set<ll>
#define pii pair<ll,ll>
#define pbi pair<bool,ll>
#define SORT(c) sort(c.begin(),c.end())
#define SORTC(c, cmp) sort(c.begin(),c.end(),cmp)
#define mapii map<ll,ll>
#define mapll map<ll,ll>
#define pb push_back

using namespace std;

int npr(int n, int r) {
    int value{1};
    for (int i = n; i > n - r; --i) {
        value *= i;
    }
    for (int j = 1; j <= r; ++j) {
        value /= j;
    }
    return value;
}

int main() {
    int n{};
    cin >> n;
    mapii dp{};
    dp[1] = 1;
    int sum{};

    for (int i = 1, x; i <= n; ++i) {
        cin >> x;
        sum += x;
        if (i == 1) continue;
        if (x == 1) {
            dp[i] = dp[i - 1];
            continue;
        }
        dp[i] = npr(sum - 1, x - 1) * dp[i - 1];

    }
    cout << dp[n]<<endl;
}


#include <bits/stdc++.h>

#define ll long long
#define vc vector<char>
#define vi vector<ll>
#define vl vector<ll>
#define vs vector<string>
#define si unordered_set<ll>
#define pii pair<ll,ll>
#define pbi pair<bool,ll>
#define SORT(c) sort(c.begin(),c.end())
#define SORTC(c, cmp) sort(c.begin(),c.end(),cmp)
#define mapii map<ll,ll>
#define mapll map<ll,ll>
#define pb push_back

using namespace std;

ll npr(ll n, ll r) {
    ll value{1};
    for (ll i = n; i > n - r; --i) {
        value *= i;
    }
    for (ll j = 1; j <= r; ++j) {
        value /= j;
    }
    return value;
}

int main() {
    ll n{};
    cin >> n;
    mapii dp{};
    dp[1] = 1;
    ll sum{};

    for (ll i = 1, x; i <= n; ++i) {
        cin >> x;
        sum += x;
        if (i == 1) continue;
        if (x == 1) {
            dp[i] = dp[i - 1];
            continue;
        }
        dp[i] = npr(sum - 1, x - 1) * dp[i - 1];

    }
    cout << dp[n]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define re register
#define gcd __gcd
#define Fi first
#define Se second
#define mp make_pair
#define lowbit(x) ((x)&-(x))
typedef long long LL;
typedef pair<int,int> pii;
const int N = 1e3+7;
const int M = 4e5;
const int lim = 1e3;
const int p = 1e9+7;
const int inf = 0x3f3f3f3f;
LL inv[N],fac[N],a[N];
void init()
{
	fac[0]=inv[0]=inv[1]=1;
	for(LL i=1;i<=lim;i++)
		fac[i]=fac[i-1]*i%p;
	for(LL i=2;i<=lim;i++)
		inv[i]=(p-p/i)*inv[p%i]%p;
	for(LL i=1;i<=lim;i++)
		inv[i]=inv[i-1]*inv[i]%p;
}
LL C(int n,int m)
{
	return fac[n]*inv[m]%p*inv[n-m]%p;
}
int main()
{
	init();
	int n,sum=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
		sum += a[i];
	}
	LL ans = 1;
	for(int i=n-1;i>=0;i--)
	{
		ans = (ans*C(sum-1,a[i]-1))%p;
		sum -= a[i];
	}
	printf("%lld\n",ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAX_N=1000+10;
long long int c[MAX_N][MAX_N],dp[MAX_N],x[MAX_N],y[MAX_N];

int main()
{
    //INPUT
    long long int n,m=1000000007;
    cin >> n;
    y[0]=0;
    for(int i=1;i<=n;i++)
    {
        cin >> x[i];
        y[i]=x[i]+y[i-1];
    }
    //SOLVE
    //MAKE C
    for(int i=0;i<MAX_N;i++)
    {
        c[i][0]=1;
        c[i][i]=1;
    }
    for(int i=1;i<MAX_N;i++)
    {
        for(int j=1;j<i;j++)
        {
            c[i][j]=c[i-1][j]+c[i-1][j-1];
            c[i][j]%=m;
        }
    }
    //MAKE DP
    dp[1]=1;
    for(int i=2;i<=n;i++)
    {
        dp[i]=c[y[i]-1][x[i]-1];
        dp[i]%=m;
        dp[i]*=dp[i-1];
        dp[i]%=m;
    }
    long long int ans=dp[n];
    //OUTPUT
    cout << ans;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Gaurav Tiwari
 */

#include <bits/stdc++.h>
#define mod 1000000007ll
#define mod2 100000009ll
#define mod3 998244353
#define pb push_back
#define fastIO ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define readi(x) scanf("%d",&x)
#define reads(x)  scanf("%s", x)
#define readl(x) scanf("%I64d",&x)
#define PI 3.141592653589793238462643383
#define repi(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a;i>b;i--)
#define mp make_pair
#define ll long long
#define sorti(a,b) sort(a,b)
#define sortd(a,b,tp) sort(a,b,greater<tp>())
#define fi first
#define se second

using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<long double,long double>pdd;
template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>;

ll comb[1010][1010];

class CKyoyaAndColoredBalls {
public:
	void solve(istream& cin, ostream& cout) {
	    int k;
        cin>>k;
        int arr[k];
        repi(i,0,k)
        cin>>arr[i];
        comb[0][0]=1;
        for(int i=0;i<1010;i++)
        {
            comb[i][0]=1;
            for(int j=1;j<=i;j++)
            {
                comb[i][j]=(comb[i-1][j]+comb[i-1][j-1])%mod;
            }
        }

        long ans=1,total=0;
        for(int i=0;i<k;i++)
        {
            ans=(ans*comb[total+arr[i]-1][arr[i]-1])%mod;
            total+=arr[i];
        }
        cout<<ans;

	}
};

int main() {
    fastIO;
	CKyoyaAndColoredBalls solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define ll long long
const ll mod=1000000007;
const int maxn=1000000+100;
void open1(int x){
	char s[20]="";
	int a[20],sum=0;
	while(x){
		a[sum++]=x%10;
		x/=10;
	}
	for(int i=sum-1;i>=0;i--) s[sum-1-i]+=a[i]+'0';
	s[sum]='.',s[sum+1]='i',s[sum+2]='n',s[sum+3]='\0';
	freopen(s,"r",stdin);
}
void open2(int x){
	char s[20]="";
	int a[20],sum=0;
	while(x){
		a[sum++]=x%10;
		x/=10;
	}
	for(int i=sum-1;i>=0;i--) s[sum-1-i]+=a[i]+'0';
	s[sum]='.',s[sum+1]='o',s[sum+2]='u',s[sum+3]='t',s[sum+4]='\0';
	freopen(s,"w",stdout);
}
ll fac[maxn];
ll qp(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}
void init(){
	fac[0]=1;
	for(int i=1;i<maxn;i++){
		fac[i]=fac[i-1]*i%mod;
	}
}
ll c(ll a,ll b){
	return fac[a]*qp(fac[a-b],mod-2)%mod*qp(fac[b],mod-2)%mod;
}
int solution(int k,vector<int> a){
	init();
	ll sum=0;
	for(int i=0;i<k;i++){
		sum+=a[i];
	}
	ll ans=1;
	for(int i=k-1;i>=0;i--){
		ans=ans*c(sum-1,a[i]-1)%mod;
		sum-=a[i];
	}
	return ans;
}
int main()
{
//	for(int it=1;it<=30;it++){
//		open1(it);
//		open2(it);
		int k;
		char x;
		scanf("%d",&k);
		vector<int>a(k,0);
		for(int i=0;i<k;i++){
			scanf("%d",&a[i]);
		}
		printf("%d\n",solution(k,a));
//	}
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int zz(int y,int x)
{
	int ans=1;
	for(int i=0;i<x;i++)
	{
		ans=ans*(y-i)%mod;
	}
	for(int i=1;i<=x;i++)
	{
		ans=ans/i%mod;
	}
	return ans;
}
int main()
{
	int n,u=0;
	int a[1005];
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i],u+=a[i];
	int sum=1;
	int q=u-1;
	for(int i=n-1;i>=0;i--)
	{
		int r=a[i]-1;
		sum*=zz(q,r);
		q=q-a[i];
	}
	cout<<sum<<endl;
}


#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1000000007;
long long int zz(long long int y,long long int x)
{
	if(x==0)return 1;
	long long int ans=1;
	for(long long int i=0;i<x;i++)
	{
		ans=(ans*(y-i)/(i+1))%mod;
	}
	return ans;
}
int main()
{
	long long int n,u=0;
	long long int a[1005];
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i],u+=a[i];
	long long int sum=1;
	long long int q=u-1;
	for(int i=n-1;i>=0;i--)
	{
		long long int r=a[i]-1;
		sum=(sum*zz(q,r))%mod;
		q=q-a[i];
	}
	cout<<sum<<endl;
}


#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int zz(int y,int x)
{
	int ans=1;
	for(int i=0;i<x;i++)
	{
		ans=ans*(y-i)%mod;
	}
	for(int i=1;i<=x;i++)
	{
		ans=ans/i%mod;
	}
	return ans;
}
int main()
{
	int n,u=0;
	int a[1005];
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i],u+=a[i];
	int sum=1;
	int q=u-1;
	for(int i=n-1;i>=0;i--)
	{
		int r=a[i]-1;
		sum*=zz(q,r)%mod;
		q=q-a[i];
	}
	cout<<sum<<endl;
}


#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1000000007;
long long int n,u=0;
long long int a[1005],b[1005][1005];
void zz()
{
    memset(b,0,sizeof(b));
    for(long long int i=1;i<1005;i++)
    {
        b[i][0]=b[i][i]=1;
        for(long long int j=1;j<i;++j)
        {
            b[i][j]=(b[i-1][j-1]+b[i-1][j])%mod;
        }
    }
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i],u+=a[i];
	long long int sum=1;
	long long int q=u-1;
	zz();
	for(int i=n-1;i>=0;i--)
	{
		long long int r=a[i]-1;
		sum=(sum*b[q][r])%mod;
		q=q-a[i];
	}
	cout<<sum<<endl;
}


#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
const int mod=1000000007;
long long int n,u=0;
long long int a[1005],b[1005][1005];
void zz()
{
    memset(b,0,sizeof(b));
    for(long long int i=1;i<1005;i++)
    {
        b[i][0]=b[i][i]=1;
        for(long long int j=1;j<i;++j)
        {
            b[i][j]=(b[i-1][j-1]+b[i-1][j])%mod;
        }
    }
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i],u+=a[i];
	long long int sum=1;
	long long int q=u-1;
	zz();
	for(int i=n-1;i>=0;i--)
	{
		long long int r=a[i]-1;
		sum=(sum*b[q][r])%mod;
		q=q-a[i];
	}
	cout<<sum<<endl;
}


#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
const int mod=1000000007;
long long int n,u=0;
long long int a[1005],b[1005][1005];
void zz()
{
    memset(b,0,sizeof(b));
    for(long long int i=1;i<1005;i++)
    {
        b[i][0]=b[i][i]=1;
        for(long long int j=1;j<i;++j)
        {
            b[i][j]=(b[i-1][j-1]+b[i-1][j])%mod;
        }
    }
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i],u+=a[i];
	long long int sum=1;
	long long int q=u-1;
	zz();
	for(int i=n-1;i>0;i--)
	{
		long long int r=a[i]-1;
		sum=(sum*b[q][r])%mod;
		q=q-a[i];
	}
	cout<<sum<<endl;
}


/*Ankon Ghosh
  KUET,ECE 2K16*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
///#include <ext/pb_ds/detail/standard_policies.hpp>*/
///using namespace __gnu_pbds;
using namespace std;
#define  ff             first
#define  ss             second
#define  m_p            make_pair
#define  p_b            push_back
#define  ll             long long
#define  inf            1e9
#define  eps            1e-8
#define  MAX            2000005
#define  mod            1000000007
#define  fast           ios_base::sync_with_stdio(false); cin.tie(NULL)
#define  output         freopen("output.txt","w",stdout)
#define  FOR(i,n)       for(ll i=0;i<n;i++)
#define  FOR1(i,n)      for(ll i=1;i<=n;i++)
#define  POPCOUNT       __builtin_popcountll
#define  RIGHTMOST      __builtin_ctzll
#define  LEFTMOST(x)    (63-__builtin_clzll((x)))
#define  setpre(number) cout<<fixed<<setprecision(7)<<number<<endl

/*----------------------Graph Moves----------------*/
//ll dx[]={+1,-1,+0,+0};
//ll dy[]={+0,+0,+1,-1};
//ll dx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//ll dy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//ll dx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//ll dy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

ll ta,n,m,a,b,c,d,x,y,sum=0,cnt,k,tot=0,q,w,u,s,e,h,tb;

vector<ll>v;
map<ll,ll>mp;
ll fact[MAX+10],inv[MAX+10];
ll big_mod (ll a, ll b, ll c)
{
    ll res = 1;
    while (b > 0)
    {
        if (b % 2 == 1)
        {
            res = (res * a) % c;
        }
        a = (a * a) % c;
        b=b/2;
    }
    return res;
}
void prec()
{
    fact[0LL]=1;
    for(ll i=1;i<=MAX;i++) fact[i]=(fact[i-1]*i)%mod;
    for(ll i=0;i<=MAX;i++) inv[i]=big_mod(fact[i],mod-2,mod)%mod;
}
ll ncr(ll n,ll r)
{
    ///cout<<n<<" "<<r<<endl;
    ll up=fact[n];
    ll down=(((inv[n-r]*inv[r])%mod)+mod)%mod;
    return (((up*down)%mod)+mod)%mod;
    ///return ((((fact[n]%mod)*(inv[n-r]%mod)*(inv[r]%mod))%mod)+mod)%mod;
}
int main()
{
    ///freopen("input.txt","r",stdin);
    fast;
    cin>>n;
    prec();
    sum=0;
    ll ans=1;
    for(ll i=0;i<n;i++)
    {
        cin>>a;
        sum+=a;
        if(i==0) continue;
        ///cout<<sum-1<<" "<<a-1<<" "<<ncr(sum-1,a-1)<<endl;
        ans=(((ans*ncr(sum-1,a-1))%mod)+mod)%mod;
    }
    cout<<(((ans)%mod)+mod)%mod<<endl;
    return 0;
}