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

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

The total number of balls doesn't exceed 1000.
#include<bits/stdc++.h>
#define endl '\n'
#define _ printf("\n");
#define F(i, s, e) for(int (i) = (s); (i) < (e); ++(i))
using namespace std;void __init__();typedef long long ll;typedef unsigned long long ull;typedef unsigned int ui;inline void out(double)__attribute__((always_inline));inline void out(char) __attribute__((always_inline));inline void out(char *) __attribute__((always_inline));inline void out(ll) __attribute__((always_inline));inline void out(int) __attribute__((always_inline));inline void out(int, int) __attribute__((always_inline));inline void out(int, int, int) __attribute__((always_inline));inline void out(int, int, int, int) __attribute__((always_inline));template<typename T> void out(T*, int, char = ' ') __attribute__((always_inline));inline void in(char c) __attribute__((always_inline));inline void in(char * s) __attribute__((always_inline));inline void in(int&) __attribute__((always_inline));inline void in(int&, int&) __attribute__((always_inline));inline void in(int&, int&, int&) __attribute__((always_inline));inline void in(int&, int&, int&, int&) __attribute__((always_inline));template<typename T> void in(T*, int) __attribute__((always_inline));

int n;
int cnt[1111];
ull  dp[1111];
ull len[1111];
const ull MOD = 1000000007;


ull C(int n, int k)
{
    assert(n >= k);
    if(k == 0) return 1;

    ull ans = 1;
    for(int i = n; i > n - k; --i)
    {
        ans *= i;
        ans %= MOD;
    }
    for(int i = 2; i <= k; ++i)
    {
        if(ans / i != 0)
            ans /= i;
        else
            ans = (ans + MOD) / i;
    }

    return ans % MOD;
}

int main(){ __init__();
/*************************
  Solution starts here.
*************************/

    in(n);
    in(cnt, n);

     dp[0] = 1;
    len[0] = cnt[0];
    for(int i = 1; i < n; ++i)
    {
        len[i] = len[i - 1] + cnt[i] - 1;
         dp[i] = (dp[i - 1] * C(len[i], cnt[i] - 1)) % MOD;
        len[i]++;
    }

    cout << (dp[n - 1] % MOD);

/*************************
  Solution ends here.
*************************/
    _ return 0;
}

void in(char c)
{
    scanf("%c", c);
}
void in(char * s)
{
    scanf("%s", s);
}
void in(int &a)
{
    scanf("%d", &a);
}
void in(int &a, int &b)
{
    scanf("%d%d", &a, &b);
}
void in(int &a, int &b, int &c)
{
    scanf("%d%d%d", &a, &b, &c);
}
void in(int &a, int &b, int &c, int &d)
{
    scanf("%d%d%d%d", &a, &b, &c, &d);
}
template<typename T>
void in(T * arr, int n)
{
    for(int i = 0; i < n; ++i)
        in(arr[i]);
}

inline void out(double d)
{
    printf("%.15lf", d);
}
inline void out(char c)
{
    printf("%c", c);
}
inline void out(char * s)
{
    printf("%s", s);
}
inline void out(long long a)
{
    printf("%lld", a);
}
inline void out(int a)
{
    printf("%d", a);
}
inline void out(int a, int b)
{
    printf("%d %d", a, b);
}
inline void out(int a, int b, int c)
{
    printf("%d %d %d", a, b, c);
}
inline void out(int a, int b, int c, int d)
{
    printf("%d %d %d %d", a, b, c, d);
}
template<typename T>
void out(T * arr, int n, char sep)
{
    for(int i = 0; i < n; ++i)
    {
        out(arr[i]);
        out(sep);
    }
}

void __init__()
{
#ifdef LOCAL_RUN
    freopen("INPUT.TXT", "rt", stdin);
#endif // LOCAL_RUN
}
