cswork / OA打开练习工作台

MathWorksOA #12

Good Strings

估计中等可在线判题

考点(AI 标注)动规入门

Count the strings of n lowercase letters in which the absolute difference between the alphabet positions of every two adjacent letters is at most d, modulo 1,000,000,007.

This site uses a standard input/output protocol.

输入格式

One line with n d. Constraints added by this site: 1≤n≤100000, 0≤d≤25.

输出格式

Output the number of valid strings modulo 1,000,000,007.

样例 1

输入:

2 2

输出:

124

样例 2

输入:

3 5

输出:

2596

样例 3

输入:

1 0

输出:

26

样例 4

输入:

2 0

输出:

26