A sequence is -good if and .
Given four integers , , and , you are asked to calculate the sum of for each -good sequence , where for the sequence .
Since the answer could be very large, you only need to output the answer modulo .
The first line is an integer , which is the number of test cases.
For each test case, the first line contains four integers , , , , which are described in the problem description.
For each test case, output a line containing a single integer.
1 3 3 3 1
27