#P13939. [EC Final 2019] Black and White
[EC Final 2019] Black and White
题目描述
walks from the bottom-left corner of a chessboard to the top-right corner. The chessboard contains horizontal line segments and vertical line segments. The horizontal line segments are numbered from to from bottom to top and the vertical ones are numbered from to from left to right. The intersection of horizontal line segment and vertical segment is denoted by . The bottom-left corner is and the top-right corner is . At each step, he can only walk from to or from to .
Each of the cells is colored white or black. A cell with corners is colored white if and only if .
Given 's walking path from to , his score is where is the number of white cells to the left of his walking path and is the number of black cells to the left of his walking path.
Help count the number of walking paths with score modulo .
输入格式
The first line contains a single integer --- the number of test cases ().
Each of the next lines contains three integers , and ($1\le n\le 100000, 1\le m\le 100000, -100000\le k\le 100000$).
输出格式
For each test case, output a single integer --- the answer modulo .
5
1 1 0
1 1 -1
2 2 1
2 2 0
4 4 1
1
0
1
4
16