#P3303. [SDOI2013] 淘金
[SDOI2013] 淘金
Description
Xiao Z is playing a game called "Prospector." The game world is a 2D coordinate plane. The ranges of the -axis and -axis coordinates are both . Initially, there is one piece of gold at every integer coordinate point, for a total of pieces.
A gust of wind blows by, and the positions of the gold pieces change. The observant Xiao Z notices that the piece initially at will move to . Here denotes the product of the digits of , for example .
If the new coordinates of a piece of gold fall outside the range , we consider this piece to have been removed from the game. It can also be observed that in the resulting state, some coordinates may have more than one piece of gold, while some coordinates may have none. After this change, the game will no longer alter the positions or quantities of gold; the player can begin collecting.
Xiao Z is lazy and plans to perform only collections. Each collection can obtain all the gold at a single coordinate; after collecting, the number of gold pieces at that coordinate becomes .
Now Xiao Z wants to know, in the resulting game state, with collections, what is the maximum number of gold pieces that can be collected? The answer may be large, so Xiao Z wants the answer modulo .
Input Format
One line containing two positive integers .
Output Format
A single integer, the maximum number of gold pieces that can be collected.
12 5
18
Hint
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号