Codeforces Round 247 (Div. 2)
C
k-Tree
Codeforces
1600
原题
← BD →
翻译中…

Quite recently a creative student Lesha had a lecture on trees. After the lecture Lesha was inspired and came up with the tree of his own which he called a $*k*$-tree.

翻译中…

A $*k*$-tree is an infinite rooted tree where:

翻译中…
  • each vertex has exactly $*k*$ children;
  • each edge has some weight;
  • if we look at the edges that goes from some vertex to its children (exactly $*k*$ edges), then their weights will equal $1, 2, 3, ..., *k*$.
翻译中…

The picture below shows a part of a 3-tree.

翻译中…

image

翻译中…

As soon as Dima, a good friend of Lesha, found out about the tree, he immediately wondered: "How many paths of total weight

翻译中…

n

翻译中…

(the sum of all weights of the edges in the path) are there, starting from the root of a

翻译中…

k

翻译中…

-tree and also containing at least one edge of weight at least

翻译中…

d

翻译中…

?".

翻译中…

Help Dima find an answer to his question. As the number of ways can be rather large, print it modulo $1000000007$ ($10^{9} + 7$).

翻译中…

Input

翻译中…

A single line contains three space-separated integers: $*n*$, $*k*$ and $*d*$ ($1 ≤ *n*, *k* ≤ 100;$ $1 ≤ *d* ≤ *k*$).

翻译中…

Output

翻译中…

Print a single integer — the answer to the problem modulo $1000000007$ ($10^{9} + 7$).

翻译中…

样例

Input #1
3 3 2
Output #1
3
InputCopy OutputCopy
Input #2
3 3 3
Output #2
1
InputCopy OutputCopy
Input #3
4 3 2
Output #3
6
InputCopy OutputCopy
Input #4
4 5 2
Output #4
7
InputCopy OutputCopy
题目信息
题号
431C
时间限制
1 s
内存限制
256 MB
标签
动态规划
模拟
树

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。