mod = 10 ** 9 + 7
comb = [[0 for i in range(1005)] for j in range(1005)]
comb[0][0] = 1
for i in range(1, 1005):
comb[i][0] = 1
for j in range(1, i + 1): comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % mod
n = int(input())
ans, cur = 1, 0
for i in range(n):
a = int(input())
ans = (ans * comb[cur + a - 1][a - 1]) % mod
cur += a
print(ans)
#include <bits/stdc++.h>
using namespace std;
#define Go ios_base::sync_with_stdio(false);cin.tie(NULL)
// =========================================================================================
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector <bool> vb;
typedef vector<char> vc;
typedef vector<vector <int>> vii;
typedef pair<int, int> pi;
typedef vector<pi> FBI;
// =========================================================================================
#define F first
#define S second
#define PB push_back
#define reb(i,a,b) for (int i = a; i < b; i++)
#define REB(i,a,b) for (int i = a; i > b; i--)
#define vector(type, x, n) int n; cin>>n; vector<type> x(n); for(type &I:x) cin>>I;
#define Pre(x,v) vector<ll>x(v.size()); x[0]=v[0]; reb(i,1,v.size()) x[i] = x[i-1] + v[i];
#define Suf(x,v) int SI =v.size();vl x(SI);x[SI-1]=v[SI-1];REB(i,SI-2,-1)x[i]=x[i+1]+v[i];
#define endl "\n"
#define NO cout <<"NO\n"
#define YES cout << "YES\n"
#define nax 5000005
#define LFT p<<1, L, (L+R)>>1
#define RGT p<<1|1, ((L+R)>>1)+1, R
#define all(x) x.begin(), x.end()
#define rall(v) v.rbegin(), v.rend()
#define dmid ll mid = L + ((R - L ) >> 1);
#define tes int TES; cin >> TES; for (;TES--;)
// =========================================================================================
#define INF 100000000000000
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
#define copy_a(x) copy(x.begin(), x.end(), ostream_iterator<ll>(cout," "))
#define copy_b(x) copy (x.begin() , x.end (), ostream_iterator<ll>(cout));
#define KH cout << Ans << endl
#define Log(x) (31^__builtin_clz(x))
#define Mod 1000000007
//#define Mod 998244353
#define PI 3.14159265358979323846
const long double eps = 1e-6;
//// chose range to creat reandom number :
//// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//// int Rand = uniform_int_distribution <int>(0, N - 1)(rng);
// =========================================================================================
void add_self(int& x, int y, int mod) {
if ((x += y) >= mod) x -= mod;
}
int add(int x, int y, int mod) {
return add_self(x, y, mod), x;
}
void sub_self(int& x, int y, int mod = Mod) {
if ((x -= y) < 0) x += mod;
}
int sub(int x, int y, int mod = Mod) {
return sub_self(x, y, mod), x;
}
int mul(int x, int y, int mod = Mod) {
return (long long)x* y% mod;
}
// =========================================================================================
void Burn_The_Problem_Alive() {
/*
int n; cin >> n;
vector<int> v(n);
for (auto& I: v)cin >> I;
int c = 0;
vii Ans;
do {
vi l(100);
int mx = 0;
for (int i = 0; i < n; i++) {
l[v[i]] = i;
mx = max(mx, v[i]);
}
bool f = 0;
for (int i = 2; i <= mx; i++) {
if (l[i] < l[i - 1]) f = 1;
}
if (f)continue;
Ans.PB(v); c++;
} while (next_permutation(all(v)));
cout << c << endl;
sort(all(Ans));
for (auto I : Ans) {
copy_a(I); cout << endl;
}
*/
/*
4
1 2 3 4
P : free places
i = 0 -> add 1 place -> P = 1
we have to put 1 in the last place -> P = 0, number of 1's = 0
-> we finish index 0 in one way is to put one
i = 1 -> add v[1] = 2 -> P = 3
we have to put 2 in the last place -> P = 2 , number of 2's left is 1
we can choose 1 from 2 places to put the 2
-> we finish index 1 in 2C1 ways which is 2
i = 2 -> add v[2] = 3 -> P = 6
we have to put 3 in the last place -> P = 5 , number of 3's left is 2
we can choose 2 from 5 places to put the 3, 3
-> we finish index 2 in 5C2 ways which is 10
i = 3 -> add v[3] = 4 -> P = 10
we have to put 4 in the last place -> P = 9 , number of 4's left is 3
we can choose 3 from 9 places to put the rest of 4'th
-> we finish index 3 in 3C9 ways which is 84
the answer is 1 * 2 * 10 * 84 = 1680
*/
int N = 1005;
vii C(N, vi(N));
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (j == 0) C[i][j] = 1;
else if (i == 0) C[i][j] = 0;
else C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % Mod;
}
}
int n; cin >> n;
vi v(n);
for (int& I : v) cin >> I;
ll tot = 0;
ll Ans = 1;
for (int i = 0; i < n; i++) {
tot += v[i];
Ans *= C[tot - 1][v[i] - 1];
Ans %= Mod;
}
cout << Ans << endl;
}
// =========================================================================================
int main() {
Go;
// freopen("text.in", "r", stdin);
// freopen("text.out", "w", stdout);
int TES = 1; //cin >> TES;
while (TES--) Burn_The_Problem_Alive();
return 0;
}
415. Add Strings | 22. Generate Parentheses |
13. Roman to Integer | 2. Add Two Numbers |
515. Find Largest Value in Each Tree Row | 345. Reverse Vowels of a String |
628. Maximum Product of Three Numbers | 1526A - Mean Inequality |
1526B - I Hate 1111 | 1881. Maximum Value after Insertion |
237. Delete Node in a Linked List | 27. Remove Element |
39. Combination Sum | 378. Kth Smallest Element in a Sorted Matrix |
162. Find Peak Element | 1529A - Eshag Loves Big Arrays |
19. Remove Nth Node From End of List | 925. Long Pressed Name |
1051. Height Checker | 695. Max Area of Island |
402. Remove K Digits | 97. Interleaving String |
543. Diameter of Binary Tree | 124. Binary Tree Maximum Path Sum |
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | 501A - Contest |
160A- Twins | 752. Open the Lock |
1535A - Fair Playoff | 1538F - Interesting Function |