问题 J: Qu'est-ce Que C'est?

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:7 通过:1

题目描述

 
As a journalist, Bobo was asked to write a report about Boboland of length nnn. 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 nnn can be seen as a sequence of integers a1,...,an  where −m≤ai≤m  represents a statement with a praise degree of ai . If there are consecutive statements in the report that have a total praise degree less than and satisfy k≥2 , then these  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 a1,a2,…,an of length nnn that satisfy:
  • For all 1≤i≤n , it holds that −m≤ai≤m .
  •  For all 1≤l<r≤n , it holds that ∑i=lrai≥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≤n,m≤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 .

输入样例 复制

3 3 

输出样例 复制

130