#P6689. 序列

序列

Description

Little C came up with a problem about a bracket sequence, but he is not very good at generating testdata, so he uses a random method.

Little C fixes the length NN of a bracket sequence SS. Initially, SS is all (.

He also sets a parameter KK at the beginning, and then performs the following random process until K=0K=0:

  1. Uniformly randomly choose an integer in [1,N][1,N], and flip the bracket at this position in SS (a left bracket becomes a right bracket, and a right bracket becomes a left bracket).
  2. If this operation decreases the number of (, then decrease KK by 11.

Now the testdata is generated, and the problem is finished.

Little C asks you to compute the expected length, modulo 998244353998244353, of the longest valid bracket subsequence (not necessarily contiguous) in SS after the above operations.

Input Format

The first line contains two positive integers N,KN,K, whose meanings are given in the statement.

Output Format

Output one line containing one non-negative integer, which is the answer modulo 998244353998244353.

2 2
499122177
4 2 
873463811
1919 810
488346634

Hint

Sample Explanation 1

In the end there are only 33 possible bracket sequences: )), (), and )(. Their probabilities are 12\frac{1}{2}, 14\frac{1}{4}, and 14\frac{1}{4}, respectively.

The lengths of their longest valid bracket subsequences are 0,2,00,2,0, respectively. Therefore the final answer is 12\frac{1}{2}, i.e. 499122177499122177.

Constraints:

For the first 5%5\% of the testdata, N=1N=1.
For another 5%5\% of the testdata, N=2N=2.
For another 5%5\% of the testdata, N7N\le 7, K5K\le 5.
For another 15%15\% of the testdata, N15N\le 15, K500K\le 500.
For another 15%15\% of the testdata, N50N\le 50, K50K\le 50.
For another 15%15\% of the testdata, N500N\le 500, K100K\le 100.
For all the testdata, it is guaranteed that 1N,K50001\le N,K\le 5000.

Translated by ChatGPT 5