Ayla is an -year-old kid and she likes this beautiful number very much. Today, she prepared a new interesting problem for you based on . She gives you and , and asks to find the number of positive integers having each digit (from to ) occurring exactly times and giving modulo . Surely, the number cannot have leading zeros.
The first line contains the number of test cases .
Each of the next lines contains (1 \le k \le 2) and (0 \le m \le 10).
For each test case, print the number of positive integers satisfying Ayla's condition.
Example 1