显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
const int maxn = 100100;
using namespace std;
#define LL long long
#define MOD 998244353
LL C[2000][2000], f[maxn], n, m, sum, ans = 1;
void get_()
{
for(int i = 1; i <= 1500; i++) C[i][1] = C[0][i] = 1;
for(int i = 1; i <= 1500; i++) C[1][i] = i;
for(int i = 2; i <= 1500; i++)
for(int j = 2; j <= 1500; j++)
C[i][j] = (C[i - 1][j] + C[i][j - 1]) % MOD;
}
int main()
{
freopen("asm_formation.in", "r", stdin);
freopen("asm_formation.out", "w", stdout);
ios::sync_with_stdio(false);
get_();
cin>>n;
for(int i = 1; i <= n; i++) cin>>f[i];
sum = f[1];
for(int i = 2; i <= n; i++) {
ans = (ans * C[f[i] - 1][sum + 1]) % MOD;
sum += f[i];
}
cout<<ans<<endl;
return 0;
}