eolymp
bolt
Try our new interface for solving problems
Məsələlər

Modulo 11

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 you are required to find the number of positive integers having each digit (0 to 9) occurring exactly K times and giving M modulo 11. Surely, the number cannot have leading zeros.

Input

The first line of the input contains T denoting the number of test cases. Each of the next T lines contains K (1 ≤ K ≤ 2) and M (0 ≤ M ≤ 10).

Output

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

Zaman məhdudiyyəti 3 saniyə
Yaddaşı istafadə məhdudiyyəti 2048 MiB
Giriş verilənləri #1
2
1 0
2 0
Çıxış verilənləri #1
285120
194505988824000
Müəllif Mahmud Allahverdiyev
Mənbə EJOI Team Selection - 2018