PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000033. Cây K (k-Tree)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Cây K (k-Tree)

k-Tree

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Consider an infinite rooted tree. From every vertex, exactly kk edges lead to its children, with edge weights 1,2,…,k1,2,\ldots,k.

A path starts at the root and follows edges downward. Its weight is the sum of its edge weights. Count paths whose total weight is exactly nn and which contain at least one edge of weight at least dd.

Print the result modulo 109+710^9+7.

Input

One line contains the integers nn, kk, and dd.

Output

Print the number of valid paths modulo 109+710^9+7.

Subtasks

  • Subtask 1 (20 points): 1≤n≤151\le n\le 15; 1≤k≤1001\le k\le 100; 1≤d≤k1\le d\le k.
  • Subtask 2 (30 points): 1≤n≤601\le n\le 60; 1≤k≤1001\le k\le 100; 1≤d≤k1\le d\le k.
  • Subtask 3 (50 points): 1≤n≤1001\le n\le 100; 1≤k≤1001\le k\le 100; 1≤d≤k1\le d\le k.

Examples

Input

3 3 2

Output

3

Explanation

The paths with total weight 33 and at least one edge of weight at least 22 have sequences (3)(3), (1,2)(1,2), and (2,1)(2,1). The sequence (1,1,1)(1,1,1) does not qualify. Thus the answer is 33.