Once upon a time there was a kingdom called Ladoo Land. Ladooland had recently
been at war with Gol Gappa Land. The Senapati of Ladooland played a major role and
won the war for his kingdom.
The king was extremely pleased with his Senapati. So he organised a great parade to
honour his Senapati Ladoo Veer.
The Senapati was rewarded handsomely with ladoos. He felt that he would not be able to
eat all the ladoos, so he decided to give away N ladoos amongst his M soldiers.
The Senapati asked his son Ladoo Singh to distribute the ladoos in a way that each soldier
gets at least 2 ladoos.
Can you help Ladoo Singh help find the number of ways to do so?.
First line contains single integer T, the number of test cases. Then T lines follow each containing 2 integers - N and M.
Output contains t lines; each line contains the answer for that test case. As the answer can be large, print the answer modulo 10^9+7
Input: 1 11 5. Output: 5
|Tags||combinatorics, inlo1601, medium, ravit0001|
|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, SCALA, 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, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions