This page is still under construction.

Parts of this page are still being built. What you see may change.

Playlist

Interview

Time limit2sMemory limit512 MB

Summary
Count length-P sequences over N songs where every song appears at least once and any two copies of the same song are separated by at least M other songs.
Level

Medium6 of 10

Topics
Dynamic programming, Combinatorics, Math, Implementation
Solved
No attempts yet

Problem

Subin solves problems at an algorithm camp while listening to music. Subin's phone stores NN songs, and today Subin wants to listen to PP songs. Subin builds a playlist that satisfies both conditions below. The same song may be added to the playlist more than once.

  • Every one of the NN stored songs appears in the playlist at least once.
  • To add a song again, at least MM other songs must sit between the two positions that hold it in the playlist.

A playlist is a sequence of PP songs, and two playlists with the same songs in a different order count separately. Given NN, MM, and PP, write a program that counts the playlists Subin can build.

Input

The first line contains NN, MM, and PP, separated by spaces. (1≤N≤1001 \le N \le 100, 0≤M≤N0 \le M \le N, N≤P≤100N \le P \le 100)

Output

Print the number of playlists Subin can build on the first line. The count can be very large, so print it modulo 1,000,000,007.

Hint

For N=1N = 1, M=0M = 0, P=3P = 3 the only playlist is (song 1, song 1, song 1).

For N=1N = 1, M=1M = 1, P=3P = 3 no playlist exists.

For N=2N = 2, M=0M = 0, P=3P = 3 the playlists (song 1, song 1, song 1) and (song 2, song 2, song 2) do not count, because they leave one of the two songs out.

For N=2N = 2, M=1M = 1, P=4P = 4 the playlists are (song 1, song 2, song 1, song 2) and (song 2, song 1, song 2, song 1).

Examples4

  1. Example 1

    Input
    1 0 3
    
    Expected output
    1
    
  2. Example 2

    Input
    1 1 3
    
    Expected output
    0
    
  3. Example 3

    Input
    2 0 3
    
    Expected output
    6
    
  4. Example 4

    Input
    2 1 4
    
    Expected output
    2