#include <bits/stdc++.h>   using namespace std;   long long n;   long long a[1006];   long long fac[1000006];   long long power(long long a, long long i) {     if (i == 0) return 1 % 1000000007;     long long t = power(a, i / 2);     long long ans = t * t % 1000000007;     if (i % 2 == 1) ans = ans * a % 1000000007;     return ans;   }   long long work(long long m, long long i) {     return ((fac[m] % 1000000007) *             (power(fac[i] * fac[m - i] % 1000000007, 1000000007 - 2) %              1000000007)) %            1000000007;   }   int main() {     fac[0] = 1;     for (int i = 1; i < 1000006; i++) fac[i] = (fac[i - 1] * i) % 1000000007;     long long ans = 1;     long long sum = 0;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       sum += a[i];     }     for (int i = n; i >= 1; i--) {       ans = ans * work(sum - 1, a[i] - 1) % 1000000007;       sum -= a[i];     }     cout << ans;     return 0;   }   