Up-Right

Time limit: 0.5s Memory limit: 128MB Input: Output:

We imagine the infinite 2D plane. We define an up-right path as a path that uses only steps of type up (from the point (x,y)(x, y) to the point (x,y+1)(x, y+1)), right (from the point (x,y)(x, y) to the point (x+1,y)(x+1, y)), or up-right (from the point (x,y)(x, y) to the point (x+1,y+1)(x+1, y+1)). For example, a valid path is the following: (0,0)(0, 0), (0,1)(0, 1), (1,2)(1, 2), (2,2)(2, 2).

Task

You are given QQ queries, and for each query the numbers NN, MM, and KK. How many paths exist from the point (0,0)(0, 0) to the point (N,M)(N, M), knowing that we must use exactly KK up-right steps?

Input data

The first line contains the natural number QQ, with the meaning given in the statement.

Each of the next QQ lines contains a triplet of 33 natural numbers separated by spaces, NN, MM, and KK, with the meaning given in the statement.

Output data

Line ii should contain the answer for query ii, modulo 1 000 000 0071\ 000\ 000\ 007.

Constraints and clarifications

  • 1Q1 000 0001 \leq Q \leq 1 \ 000 \ 000;
  • 1N,M1 000 0001 \leq N, M \leq 1\ 000\ 000;
  • 0Kmin(N,M)0 \leq K \leq \min(N, M);
  • Due to the very large input set, it is recommended to use fastio.
  • For tests worth 1010 points: Q5;N,M,K4Q \leq 5; N, M, K \leq 4;
  • For other tests worth 2020 points: Q100 000;N,M2 000;K=0Q \leq 100\ 000; N, M \leq 2\ 000; K = 0;
  • For other tests worth 2020 points: Q100 000;N,M100 000;K=0Q \leq 100\ 000; N, M \leq 100\ 000; K = 0;
  • For other tests worth 2020 points: Q100 000;N,M,K100 000Q \leq 100\ 000; N, M, K \leq 100\ 000;
  • For other tests worth 3030 points: no additional constraints.

Example

stdin

8
2 2 1
3 3 0
3 3 1
3 3 2
3 3 3
10 15 8
1000 2000 1000
100000 200000 100000

stdout

6
20
30
12
1
875160
72475738
879467333

Explanation

The solutions for the first query are illustrated below:

Log in or sign up to be able to send submissions!