Cups and Balls

All submissions for this problem are available.
Ram is playing a game where there are exactly N cups numbered 1 to N in a row in front of him and he has balls numbered from 1 to N with him. In this game his opponent gives him a number K(0 <= K <= N), and Ram has to arrange the the balls in the cup (1 ball per cup) such that he gets exactly k good cups.
If the balls arranged in the row are numbered a_{1}, a_{2}, a_{3}, .... a_{n} then a cup is good if a_{i}  i = 1.
Ram is a mathematician so, he is thinking the total number of ways he can arrange the balls in the cups such that he get K good positions. Help ram in the problem. As the result might be large, output the ans mod 10^9 + 7.
Input:
The first line would contain the number of test cases T.
Every test case consist of two space separated values N and K.
Output:
For every test case output the single Integer, the number of ways Ram can arrange exactly N balls in the cups such that he gets K good positions mod 10^9 + 7 (1000000007)
Constraints
1 <= T <= 201 <= N <= 1000 0 <= K <= N
Examples
INPUT
5
1 0
2 1
3 2
4 1
7 4
OUTPUT
1
0
4
6
328
Author:  a_g2009 
Tags  a_g2009 
Date Added:  16022014 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, 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, 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. 