#P3896. [湖南集训] Clever Rabbit
[湖南集训] Clever Rabbit
Description
The clever rabbit defines three functions:
- denotes the number formed by arranging the digits of the decimal representation of in descending order.
- denotes the number formed by arranging the digits of the decimal representation of in ascending order.
- .
If a number equals , the rabbits call it a lucky number. Now the rabbits want to compute the sum of squares of all lucky numbers among all -digit numbers. Output the result modulo . Note that numbers may contain leading s.
Input Format
One line with two integers .
Output Format
One line with one integer, the required result.
4 10000
8276
Hint
Constraints
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号