#K2011. Binary String Ones Selection Count

    ID: 24642 Type: Default 1000ms 256MiB

Binary String Ones Selection Count

Binary String Ones Selection Count

You are given three integers (L), (Q), and (X). Here, (L) represents the length of a binary string, (Q) is the number of allowed operations (which does not affect the result), and (X) is the desired number of ones in the string. Your task is to compute the number of distinct ways to obtain exactly (X) ones by choosing (X) positions out of the (L) positions. In other words, you need to compute the binomial coefficient (C(L, X)) modulo (10^9+7).

The answer is given by the formula:
[ C(L, X) = \frac{L!}{X! (L-X)!} \mod (10^9+7) ]

Note that if (X > L), the result should be 0.

inputFormat

The input is read from standard input (stdin). The first line contains an integer (T), representing the number of test cases. Each of the following (T) lines contains three space-separated integers: (L), (Q), and (X). (Q) is given but does not affect the calculation.

outputFormat

For each test case, output the computed number (C(L, X)) modulo (10^9+7) on a separate line. The output is written to standard output (stdout).## sample

3
3 2 3
3 2 2
5 3 6
1

3 0

</p>