There are regions. Imagine them like a circular array. In -based indexing: and are neighbors, and are neighbors, and and are also neighbors (because the array is circular). In each of the regions, there are people. So there are people in total. We have to choose people from all of them. For every contiguous subarray of size , there can be only one region whose people are chosen (Because the array is circular, and are both contiguous subarrays of size ). From a chosen region, we can select maximum of two people. How many ways can we choose people from them? Two ways are different if there is a person who is selected in one but not in the other. Since the answer can be huge, print it modulo .
Input Format
The first line contains a positive integer , the number of test cases.
Each of the next lines contains four space separated integers and .
Output Format
For each test case, print a single integer on a line: the number of ways modulo .
For the first case, there are total people. Since we are only taking 1 person, the number of ways are 4.