P16807 [Lanquiao Cup 2026 China Python A] Tabletop Soccer.
Description
Xiao Lan and Xiao Qiao played a tabletop soccer match. In the whole match, a total of $N + M$ goals were scored, where Xiao Lan scored $N$ goals and Xiao Qiao scored $M$ goals.
As a loyal tabletop soccer player, Xiao Lan set himself a “challenge” before the match: at any moment during the match, his cumulative number of goals must be ahead of, or tied with, Xiao Qiao. If at the moment of any goal Xiao Qiao takes the lead, then the challenge is considered failed.
For example, if a total of $4$ goals are scored, and Xiao Lan scores $2$ goals ($N = 2$) while Xiao Qiao scores $2$ goals ($M = 2$), then among all possible scoring orders, only $2$ orders allow Xiao Lan to complete the challenge successfully: (Lan-Lan-Qiao-Qiao) and (Lan-Qiao-Lan-Qiao). For an order like (Lan-Qiao-Qiao-Lan), after the third goal, Xiao Lan has scored only $1$ goal while Xiao Qiao has scored $2$ goals, so Xiao Qiao takes the lead and the challenge fails early.
Unfortunately, the match was so intense that Xiao Lan forgot the exact scoring order after the match. He now wants to use math to derive: among all scoring orders that can reach the final score, how many different orders allow him to complete the challenge successfully?
Now, please write a program to help Xiao Lan compute the total number of scoring orders that satisfy the condition. Since the number of valid orders may be extremely large, output the result modulo $998244353$.
Input Format
The input consists of one line containing two positive integers $N$ and $M$, representing the final number of goals scored by Xiao Lan and Xiao Qiao, respectively.
Output Format
Output one line containing one integer, representing the number of scoring orders that satisfy the condition modulo $998244353$.
Explanation/Hint
### [Test Case Scale and Assumptions]
For $30\%$ of the testdata, $1 \le M \le N \le 10$.
For all testdata, $1 \le M \le N \le 10^5$.
Translated by ChatGPT 5