Modulo 11#8518

Modulo 11

3 seconds
2,048 megabytes
Easy

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.

Input

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).

Output

For each test case, print the number of positive integers satisfying Ayla's condition.

Examples

Example 1

Loading
Loading