#include<cstdio>
using namespace std;
const int ggg=998244353;
int n,m;
int f[111100]={};
int sum[111111]={};
int cheng[511111]={};
int chu[511111]={};
long long shuliang[511111]={};
long long ans[511111]={};
bool heshu[511111]={};
int xiayige[555555]={};//预处理表示下一个因子的值,以便在多次分解质因子时不用重复计算
long long kuaisumi(long long a,long long b)
{
if(b==0)
return 1;
int top=0;
bool kj[44]={};
long long te=1;
long long gg[44]={};
for(;b;b>>=1)
if(b&1)
kj[++top]=1;
else
kj[++top]=0;
gg[1]=a;
for(int i=2;i<=top;i++)
gg[i]=gg[i-1]*gg[i-1]%ggg;
for(int i=1;i<=top;i++)
if(kj[i])
te=te*gg[i]%ggg;
return te;
}
int main()
{
freopen("asm_formation.in","r",stdin);
freopen("asm_formation.out","w",stdout);
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&f[i]);
for(int i=1;i<=n;i++)
sum[i]=sum[i-1]+f[i];
for(int i=2;i<=500000;i++)//筛法求质数
for(int j=i*2;j<=500000;j=j+i)
heshu[j]=1;
for(int i=2;i<=500000;i++)
{
int j=i;
if(!heshu[i])
{
xiayige[i]=1;
continue;
}
for(int k=2;k*k<=j;k++)
if(j%k==0)
{
j/=k,xiayige[i]=j;break;
}
}
for(int i=2;i<=n;i++)
{
for(int j=1;j<f[i];j++)
cheng[sum[i]-j]++,chu[j]++;
}
for(int i=2;i<=500000;i++)
if(cheng[i]>0)
{
int j=i;
while(j>1)
{
int temp=j/xiayige[j];
shuliang[temp]=shuliang[temp]+cheng[i];
j=xiayige[j];
}
}
for(int i=2;i<=500000;i++)//计算每个质数乘的个数
if(chu[i]>0)
{
int j=i;
while(j>1)
{
int temp=j/xiayige[j];
shuliang[temp]=shuliang[temp]-chu[i];
j=xiayige[j];
}
}
long long daan=1;
for(int i=2;i<=500000;i++)
ans[i]=kuaisumi(i,shuliang[i]);//答案用快速幂求解
for(int i=2;i<=500000;i++)
daan=daan*ans[i]%ggg;
printf("%d\n",daan);
}