Qu'est-ce Que C'est?
题号:NC255865
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

As a journalist, Bobo was asked to write a report about Boboland of length n. Bobo initially wanted to write a report that was both complimentary and critical, but he was afraid that malicious people might take his words out of context and turn it into a critique of Boboland. A report of length n can be seen as a sequence of integers a_1,...,a_n where -m\leq a_i\leq m represents a statement with a praise degree of a_i. If there are k consecutive statements in the report that have a total praise degree less than 0 and satisfy k\geq 2, then these k statements may be taken out of context by malicious people to attack Bobo. Bobo does not want this to happen and wants to know how many different reports he can write without being taken out of context.

Formally, you need to calculate the number of integer sequences a_1,a_2,\dots,a_n of length n that satisfy:
  • For all 1\leq i\leq n, it holds that -m\leq a_i\leq m.
  •  For all 1\leq l<r\leq n, it holds that \sum\limits_{i=l}^{r}a_i\geq 0.


Since the answer may be large, you need to output it modulo 998244353.

输入描述:

The first line contains two positive integers n and m (1\leq n,m\leq 5000), denoting the length of the report and the range of statements in the report, respectively.

输出描述:

Output an integer in one line, denoting the answer modulo 998244353.
示例1

输入

复制
3 3

输出

复制
130
示例2

输入

复制
5 1

输出

复制
64

备注:

To aid understanding, we have provided graphical illustrations for the first example test case. We use the following seven emoji symbols from left to right to indicate the decreasing level of praise degree in the statements in the article, ranging from 3 to -3.



The following two articles meet the condition of not being taken out of context because the sum of the praise degrees of any consecutive statement segment containing more than one statement is at least 0.



The following two articles may be taken out of context, and the potentially out-of-context statements or paragraphs have been highlighted in red boxes.