Game Count

All submissions for this problem are available.
Tug of war is a sport that directly puts two teams against each other in a test of strength.
During school days, both Chef Shifu and Chef Po were champions of tug of war.
On behalf of restaurant's anniversary, Chef Shifu and Chef Po have decided to conduct
a tug of war game for their customers.
Master Chef Oogway has decided the following rules for the game.

Let N be the number of players participating in the game. All of these
players would stand in a circle in clock wise direction. 
There are an infinite number of long ropes available.
When a rope is held by exactly two players, it is termed as bonding.  At least one bonding is necessary to conduct a game.

A player can play against multiple people simultaneously i.e he can have more than one bonding at
the same time. 
Both members of a pair of players that have a bonding must have the same number of total
bondings. That is, if the player A makes bonding with the player B,
then the number of total bondings of the player A must be the same as
that of the player B.  Bondings should be created in such a fashion that ropes must not intersect each other.
 The number of bondings of every player must be no more than K.
Now Master Chef Oogway asked Chef Shifu and Chef Po to find out the number of possible games.
Your task is to help them find this number. As this number might become huge,
you've to find it modulo (10^14+7). Two games are different iff there is some
bonding that is present in only of them.
Input
First line contains T, the number of test cases.
Each of T lines contain 2 positive integers N and K separated by a space.
Output
For each test case, output the number of ways to conduct the game modulo 100000000000007 (10^{14}+7) in one line.
Example
Input: 3 3 2 4 0 2 1 Output: 4 0 1
Explanation:
For the 1st case, there are 3 players. Let's call them p1, p2, p3.
Different games possible are:
Game 1: p1p2 (numbers of bondings of p1, p2 are 1 ≤ K = 2)
Game 2: p1p3 (numbers of bondings of p1, p3 are 1 ≤ K = 2)
Game 3: p2p3 (numbers of bondings of p2, p3 are 1 ≤ K = 2)
Game 4: p1p2, p1p3, p2p3 (numbers of bondings of p1, p2, p3 are 2 ≤ K
= 2)
For the 2nd test case, we cannot form the game, because K = 0 and hence no
player is allowed to make any bonding. As any game must have atleast one
bonding, no game is possible here.
For the 3rd case, only possible game is:
Game 1: p1p2 (number of bondings in p1, p2 are 1)
Constraints
1 ≤ T ≤ 10000
0 ≤ N ≤ 10000
0 ≤ K ≤ N
Author:  khadarbasha 
Tester:  laycurse 
Editorial  http://discuss.codechef.com/problems/MAXGAME 
Tags  aug12, combinatorics, khadarbasha, recurrence 
Date Added:  15052012 
Time Limit:  0.482143 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, 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, PYP3, CLOJ, 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. 