#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(0); cin.tie(0);
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int inf = 1e9, infi32 = 2147483647, mod = 998244353;
const ll INF = 1e18;
const int N = 2e5 + 10;
int n;
int d[N];
int main () {
ios
cin >> n;
for (int i = 1; i <= n; i++) cin >> d[i];
int sum = 0, ans = 1;
for (int i = 1; i <= n; i++) sum = (sum + d[i]) % mod, ans = 1ll * ans * d[i] % mod;
for (int i = sum - n * 2 + 3; i <= sum - n; i++) ans = 1ll * ans * (i + mod) % mod;
cout << ans << "\n";
return 0;
}