There are persons and chairs. Each person needs to maintain social distance between themselves and the person they are sitting next to. Therefore, once a person sits, the person who sits next to them sits at a distance that is in multiples of the integer .
Your task is to find the total number of arrangements possible so that all the people can be seated. Print your answer modulo .
Notes
Input format
The first line contains an integer representing the number of test cases.
Each of the next lines contains three integers , , and .
Output format
Print i ntegers where the integer is the total number of arrangements for the test case.
Constraints
In the first test case, total 4 arrangements are possible. Let 5 chairs are numbered from 1 to 5, then arrangements for 2 persons are {1,3}, {1,5}, {2,4} and {3, 5}.
In the second test case, only 1 arrangement is possible.