AT_arc230_e [ARC230E] Minister
Description
You are given positive integers $ N $ and $ M $ .
A box contains one ball numbered $ 1 $ , one ball numbered $ 2 $ , $ \dots $ , one ball numbered $ N $ . There is also a blackboard with nothing written on it. Using these, Alice plays the following game.
First, Alice draws one ball from the box uniformly at random and keeps it at hand. Then, Alice performs the following sequence of operations $ N-1 $ times.
- Draw one ball from the box uniformly at random, independently of the previous operations, and keep it at hand.
- Write the sum of the numbers of the two balls at hand on the blackboard.
- Freely choose exactly one of the two balls at hand to discard, and keep the other at hand.
Alice's score in this game is defined as follows: it is $ 0 $ if the maximum value of the integers written on the blackboard is $ M $ or greater, and otherwise it is the number of the ball finally kept at hand.
Find the expected value, modulo $ 998244353 $ , of Alice's score when she acts to maximize the expected value of her score.
Definition of expected value modulo $ 998244353 $ It can be proved that the sought expected value is always a rational number. Also, under the constraints of this problem, it can be proved that when that value is represented as an irreducible fraction $ \frac{A}{B} $ , we have $ B {{}\not\equiv{}} 0 \pmod{998244353} $ . Therefore, there is a unique integer $ C $ such that $ C \times B \equiv A \pmod{998244353}, 0 \leq C < 998244353 $ . Report this $ C $ .
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ M $
Output Format
Output the answer.
Explanation/Hint
### Sample Explanation 1
The following is one possible scenario of the game.
1. One ball is drawn from the box, and its number is $ 3 $ . This ball is kept at hand.
2. One ball is drawn from the box, and its number is $ 1 $ . This ball is kept at hand. The numbers of the two balls at hand are now $ 1,3 $ .
3. Write $ 1+3=4 $ on the blackboard.
4. Discard the ball numbered $ 3 $ , keeping the ball numbered $ 1 $ at hand.
5. One ball is drawn from the box, and its number is $ 2 $ . This ball is kept at hand. The numbers of the two balls at hand are now $ 1,2 $ .
6. Write $ 1+2=3 $ on the blackboard.
7. Discard the ball numbered $ 1 $ , keeping the ball numbered $ 2 $ at hand.
8. Since the maximum value of the integers written on the blackboard is not $ 5 $ or greater, Alice obtains a score of $ 2 $ , the number of the ball finally kept at hand.
This scenario is not necessarily the result of Alice acting to maximize the expected value of her score.
The sought expected value is $ \dfrac{5}{3} \bmod{998244353}=665496237 $ .
### Constraints
- $ 2 \le N \le 3000 $
- $ 1 \le M \le 2N $
- All input values are integers.