We call a number EXcellent if it divided by euqals
or it contains the number
, see sample for details.
Now we want to know how many EXcellent numbers are between ?
Since this number can be very large, print the remainder when it's divided by lovely .
The first line contains an integer
— the number of test cases you need to solve.
The only line of each test case containsinteger
without leading zeros.
For each test case, print the result mod lovely.