#include<iostream> #include<cstdlib> #include<cstdio> #define ll long long usingnamespacestd; inlineintread() { int f = 1, x = 0; char ch;
do{ ch = getchar(); if (ch == '-') f = -1; }while(ch < '0' || ch > '9'); do{ x = x * 10 + ch - '0'; ch = getchar(); }while(ch >= '0' && ch <= '9'); return f * x; } constint N = 2e5; constint mod = 998244353;
int n; int ans = 1; ll ssum;
inlineintpow(int x, int y) { int sum = 1;
while (y) { if (y & 1) sum = 1ll * sum * x % mod; x = 1ll * x * x % mod; y >>= 1; } return sum; } inlineintC(int x, ll y) { if (x > y) return0; int sum = 1, summ = 1;
for (ll i = y - x + 1; i <= y; i++) sum = 1ll * (i % mod) * sum % mod; for (int i = 1; i <= x; i++) summ = 1ll * i * summ % mod; return1ll * sum * pow(summ, mod - 2) % mod; } intmain() { n = read(); for (int i = 1; i <= n; i++) { int x = read(); if (i <= n - 2) ans = 1ll * ans * i % mod * x % mod; else ans = 1ll * ans * x % mod; ssum += x - 1; }