#include <bits/stdc++.h>

#define reg register
#define pr std::pair<int, int>
#define fi first
#define se second
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define lep(i, l, r) for (int i = l; i < r; ++i)
#define irep(i, r, l) for (int i = r; i >= l; --i)
#define ilep(i, r, l) for (int i = r; i > l; --i)
#define Rep(i, n) rep(i, 1, n)
#define Lep(i, n) lep(i, 1, n)
#define IRep(i, n) irep(i, n, 1)
#define ILep(i, n) ilep(i, n, 1)
typedef long long ll;
typedef long double ld;

namespace modular {
    const int MOD = 1000000007;
    inline int add(int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }
    inline void inc(int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }
    inline int mul(int x, int y) { return 1LL * x * y % MOD; }
    inline int qpow(int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x))
            if (y & 1)
                ans = mul(ans, x);
        return ans;
    }
}; // namespace modular
using namespace modular;

namespace Base {
    template <typename Tp> inline Tp input() {
        Tp x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-')
                y = -1;
            c = getchar();
        }
        if (c == EOF)
            return 0;
        while ('0' <= c && c <= '9')
            x = x * 10 + c - '0', c = getchar();
        return x *= y;
    }
    template <typename Tp> inline void read(Tp &x) { x = input<Tp>(); }
    template <typename Tp> inline void chmax(Tp &x, Tp y) { x < y ? x = y : 0; }
    template <typename Tp> inline void chmin(Tp &x, Tp y) { x > y ? x = y : 0; }
}; // namespace Base
using namespace Base;
/*----------------------------------------------------------------------------*/

#define MAX_N 3007

int N;
int d[MAX_N], fac[MAX_N], ifac[MAX_N];
int f[MAX_N][MAX_N][2];

void init() {
    int MX = 3000;
    fac[0] = ifac[0] = 1;
    Rep(i, MX) fac[i] = mul(fac[i - 1], i);
    ifac[MX] = qpow(fac[MX], MOD - 2);
    irep(i, MX, 2) ifac[i - 1] = mul(ifac[i], i);
}

void solve() {
    f[0][0][0] = 1;
    int tmp;
    Rep(i, N) {
        lep(j, 0, i) {
            rep(k, 0, 1) if (tmp = f[i - 1][j][k]) {
                // if (i == 4 && k == 1)
                //     printf("%d %d %d %d\n", i, j, k, tmp);
                inc(f[i][j][k], mul(tmp, ifac[d[i] - 1]));
                if (d[i] >= 2)
                    inc(f[i][j + 1][k], mul(tmp, ifac[d[i] - 2]));
                // if (i == 4 && j == 1 && k == 0)
                //     printf("%d\n", tmp);
                if (!k && d[i] >= 3)
                    inc(f[i][j + 1][1], mul(tmp, ifac[d[i] - 3]));
                // if (!k && d[i] >= 2)
                //     inc(f[i][j][1], mul(tmp, ifac[d[i] - 2]));
                // printf("%d %d %d %d\n", i, j, k, f[i][j][k]);
                // inc(f[i][j][0], mul(f[i - 1][j][0], ifac[d[i] - 1]));
                // inc(f[i][j + 1][0], mul(f[i - 1][j][0], ifac
            }
        }
        // rep(j, 0, i) rep(k, 0, 1) printf("%d %d %d %d\n", i, j, k,
        // f[i][j][k]);
    }
    int res = 0;
    // printf("%d\n", f[N][3][1]);
    rep(i, 3, N) inc(
        res, mul(f[N][i][1], mul(fac[N - i - 1], mul(fac[i - 1], 500000004))));
    // rep(i, 3, N)
    //     printf("%d ", mul(f[N][i][1],
    //                       mul(fac[N - i - 1], mul(fac[i - 1], 500000004))));
    // puts("");
    printf("%d\n", res);
}

int main() {
#ifdef LOCAL
    FIN("a.in");
    FOUT("a.out");
#endif
    init();
    read(N);
    bool flg = true;
    Rep(i, N) read(d[i]), flg &= (d[i] == 2);
    if (flg)
        return printf("%d\n", mul(fac[N - 1], 500000004)), 0;
    solve();
    return 0;
}


Measured memory_bytes: 6784