 Server Time: Wed Jun 3, 2020 1:02 am
 Welcome ( logout ) 1095 - Arrange the Numbers  PDF (English) Statistics Forum
 Time Limit: 2 second(s) Memory Limit: 32 MB

Consider this sequence {1, 2, 3 ... N}, as an initial sequence of first N natural numbers. You can rearrange this sequence in many ways. There will be a total of N! arrangements. You have to calculate the number of arrangement of first N natural numbers, where in first M positions; exactly K numbers are in their initial position.

For Example, N = 5, M = 3, K = 2

You should count this arrangement {1, 4, 3, 2, 5}, here in first 3 positions 1 is in 1st position and 3 in 3rd position. So exactly 2 of its first 3 are in there initial position.

But you should not count {1, 2, 3, 4, 5}.

# Input

Input starts with an integer T (≤ 1000), denoting the number of test cases.

Each case contains three integers N (1 ≤ N ≤ 1000), M (M ≤ N), K (0 < K ≤ M).

# Output

For each case, print the case number and the total number of possible arrangements modulo 1000000007.

# Output for Sample Input

2

5 3 2

10 6 3

Case 1: 12

Case 2: 64320

Problem Setter: Md. Arifuzzaman Arif
Special Thanks: Jane Alam Jan (Solution, Dataset)
 Developed and Maintained by JANE ALAM JAN Copyright © 2012 LightOJ, Jane Alam Jan