3075: Gift

时间限制:1000 ms 内存限制:128 MB
上传者:
提交:1 通过:1

题目描述

Labor Day is coming. Boss Niu has prepared $n$ identical gifts for his staff generously, and all of the gifts will be given away. It is known that in Boss Niu's company, there are $m$ staff in total. Due to limited gifts, each of the staff can get at least one gift, and at most $k$ gifts.

Now Boss Niu wonders how many different ways can he distribute his gifts. Two ways are considered different if exists one staff at least, who gets $x$ gifts in the first way and gets $y$ gifts in the second way($x\neq y$). Please note that all the gifts are considered same.

Since the answer may be large, you only need to output it modulo $100000007$.

输入格式

The first line contains an integer number T, the number of test cases.

$i^{th}$ of each next T lines contains three integers $n$, $m$, $k$($1 \leq m, k \leq n \leq 10^{5}$), the number of gifts, the number of staff and the maximum number of gifts each staff can get.

输出格式

For each test case print the answer.

输入样例 复制

4
6 3 2
6 3 3
6 3 1
666 233 3

输出样例 复制

1
7
0
2726237