Task
A positive integer is called excellent if its decimal representation contains only the digits and , and it is divisible by .
For example, and are excellent numbers ( and ), while is not ().
Alex observed that there are many excellent numbers formed by digits, and thus he started counting them. However, this is taking too much time, so he gave this task as a homework for you: help him count how many excellent numbers of digits exist!
Since the answer can be big, print it modulo .
Input data
The first line of the input file contains a single integer , the number of test cases. test cases follow, each preceded by an empty line.
Each test case consists of: a line containing 64-bit integer , representing the number of digits for which we have to find the answer.
Output data
The output file must contain lines corresponding to the test cases, each consisting of integer , representing the number of excellent numbers with digits modulo (i.e. the reminder of the division by ).
Constraints and clarifications
- .
- .
# | Points | Constraints |
---|---|---|
1 | 0 | Examples |
2 | 13 | |
3 | 24 | |
4 | 34 | |
5 | 29 | No additional constraints |
Example
stdin
5
5
3
10
39
952
stdout
10
2
342
251936681
897205658
Explanation
In the first testcase of the sample case, we have .
There are excellent numbers with digits.
In increasing order they are: , , , , , , , , and .
In the second testcase we have .
There are excellent numbers with digits: and .
In the fourth testcase there are excellent numbers with digits.
This number modulo is .