cswork / OAOpen practice workspace

MathWorksOA #7

Valid Passwords

Estimated MediumJudge-ready

Topics (AI-labelled)DP BasicsPrefix & Ranges

A password has length n, contains only lowercase English letters, and must not contain k consecutive identical characters. Count the distinct valid passwords modulo 1,000,000,007.

See below for this site's input/output protocol.

Input

One line with n k. 2≤k≤n≤100000.

Output

Output the total number of valid passwords modulo 1,000,000,007.

Example 1

Input:

3 2

Output:

16250

Example 2

Input:

3 3

Output:

17550

Example 3

Input:

5 2

Output:

10156250

Editorial

Loading solution…