#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int maxk = 1000 + 10;
const int maxs = 5000 + 10;
int k, num[maxk];
long l[maxs];
int count = 0, sum = 0;
long long ans;
void fun()
{
int t = 1, r = 1, u ,v, w, o;
bool b;
for (int i = 2; i <= k; i++)
{
t = t * num[i];
}
o = sum - k;
for (int i = 1; i <= o; i++)
{
r = r * i;
}
ans = r * t -(r-1) * (t-1);
}
int main()
{
freopen("asm_formation.in","r",stdin);
freopen("asm_formation.out","w",stdout);
cin >> k;
for (int i = 1; i <= k; i++)
{
cin >> num[i];
sum += num[i];
}
fun();
cout << ans % 998244353 << endl;
return 0;
}