Statement
Statement language
For positive integers , define as the integer formed by concatenating copies of the decimal representation of . For example, and .
You are given a sequence of positive integers . Find the value of the following expression modulo .
Input
The input is given in the following format:
Each case is given in the following format:
is the number of test cases.
Output
For each test case, print the required remainder on one line.
Constraints
- .
- .
- ().
- The sum of over all test cases is at most .
Subtasks
Samples
Input
3
2
2 3
3
1 2 1
2
998244353 1
Output
222
22
0
The first product is . The second is .