Donation

All submissions for this problem are available.
Bill is a billionaire but very downtoearth. He finds peace in donating gold coins to charities. He always liked the gold coins he had and used to number them with integers. One day he decided to donate $N$ coins (coins numbered $1$ to $N$) to $C$ charities in the country. But Bill is a very moody person, some day he orders that each charity must receive at least one coin, sometimes he says at least two coins and some times at least three coins. But, every charity must receive coins. Bill’s assistant Alice was once interested in the following question: In how many different ways can the $N$ coins be distributed to the $C$ charities, based on the order given by Bill? The charities can be assumed to be identical, i.e, ordering on the charities doesn’t matter. But ordering on the coins matters as all coins are uniquely numbered. For example, even if we fix that one charity gets $1$ coin and the other gets $2$, then the possible different ways of distribution are $\{(1)$, $(2,3)\}$, $\{(2)$, $(1,3)\}$ and $\{(3)$,$(1,2)\}$. Note: On a day, Bill either orders that each charity gets at least $1$ coins, or at least $2$ coins or at least $3$ coins only. For a day, this value is fixed [$1$, $2$ or $3$]. **Also, all coins are to be distributed.** ###Input:  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first and only line of each test case contains three spaceseparated integers $N$,$C$,$M$, denoting number of coins, number of charities and the minimum number of coins to be given to each charity[$1$, $2$ or $3$]. ###Output: For each test case, output in a single line an integer denoting the total number different ways to distribute the $N$ coins to the $C$ charities with each charity getting at least $M$ coins. (charities can be assumed identical, whereas the coins are unique and labelled). As the answer can be huge, print the answer modulo $10^9+7$ ###Constraints  $1 \leq T \leq 100$  $1 \leq C \leq N \leq 1000 $  $ M \in \{1,2,3\}$ ###Sample Input:3 5 3 1 5 2 2 6 2 3###Sample Output:
25 10 10
Author:  kishen1912000 
Editorial  https://discuss.codechef.com/problems/DONATE 
Tags  cnxh2020, combinatorics, dynamicprogramming, kishen1912000 
Date Added:  4012020 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 