P6475 [NOI Online #2 Junior] Building a City
Description
Qiuqiu is an architect. One day, he received a task from the mayor: build a city. Qiuqiu plans to build $2n$ skyscrapers. To make the city look nice, Qiuqiu makes the following plan:
- Qiuqiu likes neat things. He wants the skyscrapers to be arranged in a line from left to right, numbered $1\sim 2n$.
- Qiuqiu likes integers. He requires the height of each skyscraper to be a positive integer.
- Due to material limits, the height of any skyscraper cannot exceed $m$.
- Qiuqiu likes a shape that is high in the middle and low on both sides. He requires that the heights of the first $n$ skyscrapers do not decrease, and the heights of the last $n$ skyscrapers do not increase.
- Qiuqiu plans to choose two skyscrapers with indices $x,y$ as the landmarks of the city. He believes the city looks nice only when these two skyscrapers have the same height.
Qiuqiu told the mayor his idea. The mayor wants to know the total number of possible building plans. Two plans are different if and only if there exists a skyscraper whose height is different in the two plans. This problem stumped Qiuqiu, so he came to you for help. Since the answer may be very large, you only need to output the result modulo $998244353$.
Input Format
Read data from standard input.
There is only one line with four integers $m,n,x,y$. The meanings of the variables are given in the statement.
Output Format
Write to standard output.
Output one line containing one integer, the answer.
Explanation/Hint
For sample $1$, all plans are: $\{1,1,1,1\},\{1,2,1,1\},\{1,3,1,1\},\{2,2,2,1\},\{2,2,2,2\},\\\{2,3,2,1\},\{2,3,2,2\},\{3,3,3,1\},\{3,3,3,2\},\{3,3,3,3\}$.
For $10\%$ of the testdata, $1\le n,m\le 5$.
For $30\%$ of the testdata, $1\le n,m\le 100$.
For $60\%$ of the testdata, $1\le n,m\le 1000$.
For $100\%$ of the testdata, $1\le x < y \le 2n$, $1\le n,m \le 10^5$.
Translated by ChatGPT 5