#include<cstdio>
long long s[41][500001]={0};
int p[1001]={0};
int main()
{
freopen("asm_formation.in","r",stdin);
freopen("asm_formation.out","w",stdout);
for (int i=1;i<=40;i++) s[i][1]=1;
for (int i=1;i<=500000;i++) s[1][i]=i;
for (int i=1;i<=500000;i++) s[0][i]=1;
for (int i=2;i<=40;i++)
for (int j=2;j<=500000;j++)
s[i][j]=(s[i-1][j]+s[i][j-1])% 998244353;
int n;
long long sum=0,ans=1;
scanf("%d",&n);
for (int i=1;i<=n;i++)
scanf("%d",&p[i]);
sum=p[1];
for (int i=2;i<=n;i++)
{
ans=(ans*s[p[i]-1][sum+1])% 998244353;
sum+=p[i];
}
printf("%lld",ans);
}