#include #include #include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; const int MX = 1000010; mint f[MX],inv[MX],fi[MX]; constexpr ll mod = 998244353; void solve(){ inv[1] = 1; for(int i=2;i> n >> m; for(i=0;i> a[i]; vector ff(m + 1),gg(m + 1),hh(m + 1); for(i=0;i<=m;i++){ if(a[0] - a[1] + i>=0) ff[i] = fi[i]*fi[a[0] - a[1] + i]; if(a[1] - a[2] + i>=0) gg[i] = fi[i]*fi[a[1] - a[2] + i]; if(a[2] - a[3] + i>=0) hh[i] = fi[i]*fi[a[2] - a[3] + i]; } ff = convolution(ff,gg); ff = convolution(ff,hh); mint ans = 0; for(i=0;i<=m;i++){ if(a[3] - i>=0 && (m - a[0]) - i>=0) ans += ff[i]*fi[a[3] - i]*fi[m - a[0] - i]; } ans *= f[m]; cout << ans.val() << "\n"; }