Competitions

# Modulo 11

Ayla is 11 years-old kid and she likes this beautiful number very much. Today, she prepared a new interesting problem for you based on 11. She gives you k and m, and asks to find the number of positive integers having each digit (from 0 to 9) occurring exactly k times and giving m modulo 11. Surely, the number cannot have leading zeros.

#### Input

The first line contains the number of test cases t.

Each of the next t lines contains k (1k2) and m (0m10).

#### Output

For each test case, print the number of positive integers satisfying Aylas condition.

Time limit 3 seconds
Memory limit 2048 MiB
Input example #1
2
1 0
2 0

Output example #1
285120
194505988824000`
Author Mahmud Allahverdiyev / PE-4xx (modified version)
Source EJOI Team Selection - 2018