#P6475. [NOI Online #2 入门组] 建设城市

[NOI Online #2 入门组] 建设城市

Problem Description

Qiuqiu is an architect. One day, he received a task from the mayor: build a city. Qiuqiu plans to build 2n2n 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 12n1\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 mm.

  • Qiuqiu likes a shape that is high in the middle and low on both sides. He requires that the heights of the first nn skyscrapers do not decrease, and the heights of the last nn skyscrapers do not increase.

  • Qiuqiu plans to choose two skyscrapers with indices x,yx,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 998244353998244353.

Input Format

Read data from standard input.

There is only one line with four integers m,n,x,ym,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.

3 2 1 3
10
1000 1000 535 1477
295916566

Hint

For sample 11, 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%10\% of the testdata, 1n,m51\le n,m\le 5.

For 30%30\% of the testdata, 1n,m1001\le n,m\le 100.

For 60%60\% of the testdata, 1n,m10001\le n,m\le 1000.

For 100%100\% of the testdata, 1x<y2n1\le x < y \le 2n, 1n,m1051\le n,m \le 10^5.

Translated by ChatGPT 5