- Time limit: 1.00 s
- Memory limit: 512 MB
Consider a two player game where each player has cards numbered . On each turn both players place one of their cards on the table. The player who placed the higher card gets one point. If the cards are equal, neither player gets a point. The game continues until all cards have been played.
You are given the number of cards and the players' scores at the end of the game, and . Your task is to count the number of possible games with that outcome.
Input
The first line contains one integer : the number of tests.
Then there are lines, each with three integers , and .
Output
For each test case print the number of possible games modulo .
Constraints
Example
Input:
5 3 1 2 2 0 1 5 2 2 9 3 5 4 4 1
Output:
6 0 4200 976757050 0