#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long Inf = 1e18;
const int N = 110;
const int mod = 1e9 + 7;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
template <typename T>
bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
};
template <typename T>
bool chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
};
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
int sub(int a, int b) { return a - b < 0 ? a - b + mod : a - b; }
void inc(int &a, int b) { a = (a + b >= mod ? a + b - mod : a + b); }
void dec(int &a, int b) { a = (a - b < 0 ? a - b + mod : a - b); }
int n, d[N], sd[N], f[N][N][N], g[N][N];
int calc(int i, int j, int k) {
  if (f[i][j][k] != -1) return f[i][j][k];
  if (j + k == 0) return f[i][j][k] = 0;
  int ret = 0;
  if (k > 0) {
    if (i > 1) inc(ret, 1ll * i * (i - 1) / 2 * calc(i - 2, j, k - 1) % mod);
    if (i && j) inc(ret, 1ll * i * j * calc(i - 1, j - 1, k - 1) % mod);
    if (i && k > 1)
      inc(ret, 1ll * i * (k - 1) * calc(i - 1, j + 1, k - 2) % mod);
    if (j > 1) inc(ret, 1ll * j * (j - 1) / 2 * calc(i, j - 2, k - 1) % mod);
    if (j && k > 1) inc(ret, 1ll * j * (k - 1) * calc(i, j, k - 2) % mod);
    if (k > 2)
      inc(ret, 1ll * (k - 1) * (k - 2) / 2 * calc(i, j + 2, k - 3) % mod);
  } else {
    if (i) inc(ret, 1ll * i * calc(i - 1, j - 1, k) % mod);
    if (j > 1) inc(ret, 1ll * (j - 1) * calc(i, j - 2, k) % mod);
  }
  return f[i][j][k] = ret;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) d[i] = gi();
  memset(f, -1, sizeof(f));
  f[0][0][0] = 1;
  g[n + 1][n] = 1;
  for (int i = 1; i <= n; i++) sd[i] = sd[i - 1] + d[i] - 1;
  for (int i = n; i > 1; i--)
    for (int j = i; j <= n; j++) {
      int cnt2 = sd[j] - sd[i - 1] - (j - i + 1), cnt1 = j - i + 1 - cnt2;
      for (int k = j; k <= n; k++)
        inc(g[i][j], 1ll * calc(k - j, cnt1, cnt2) * g[j + 1][k] % mod);
    }
  printf("%d\n", g[2][d[1] + 1]);
  return 0;
}
