#include using namespace std; using ll = long long; const int MX = 400010; ll f[MX],inv[MX],fi[MX]; constexpr ll mod = 998244353; void solve(){ inv[1] = 1; for(int i=2;i> n; string s; cin >> s; solve(); int z = 0; for(i=0;i=2 && j) dp[i][j] += dp[i - 2][j - 1]*(i - 1)%mod; if(i) dp[i][j] += dp[i - 1][j]*j%mod; if(i && j) dp[i][j] += dp[i - 1][j - 1]*(i - j)%mod; dp[i][j] %= mod; } } ll ans = 0; for(i=0;i<=n;i++){ for(j=0;j<=i;j++){ int a = j,b = i - j,c = n - i; (ans += dp[i][j]*nck(n,i)%mod*nck(z,a)%mod*f[a]%mod*nck(n - z,b)%mod*f[b]%mod*f[c]%mod) %= mod; } //cout << i << " " << ans << endl; } cout << ans << "\n"; }