#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
  long long int ans = 1;
  while (y > 0) {
    if (y % 2 != 0) {
      ans = (ans * x) % 1000000007ll;
    }
    x = (x * x) % 1000000007ll;
    y /= 2;
  }
  return (ans % 1000000007ll);
}
int main() {
  long long int k, a[1010], i, j, ans = 0, sum = 0, x, dp[1010][1010];
  cin >> k;
  for (i = 1; i <= k; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  dp[0][1] = 1;
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= a[i]; j++) {
      if (j == 1)
        dp[i][j] = dp[i - 1][a[i - 1]];
      else
        dp[i][j] = ((((dp[i][j - 1] % 1000000007ll) * (sum % 1000000007ll)) %
                     1000000007ll) *
                    (power(j - 1, 1000000007ll - 2))) %
                   1000000007ll;
      sum++;
      dp[i][j] %= 1000000007ll;
    }
  }
  cout << dp[k][a[k]];
  return 0;
}
