#P8825. [传智杯 #3 初赛] 运气
[传智杯 #3 初赛] 运气
Description
Harlan Sweety is a well-known lead-loaded dice enthusiast in YYH Land. One day, he ran into the following problem:
You have a -faced die, labeled , and each face has an equal probability of landing face up.
Now Harlan wants to know: if he rolls the die times and writes the results in order on paper to form a number (for example, if Harlan rolls times and gets , then the final number is ), how many possible outcomes make this number a multiple of , where is a given number.
Since the number of such outcomes may be very large, output the result modulo .
Input Format
One line with two integers , as described above.
Output Format
One line with one integer, the answer.
2 11
6
Hint
Sample Explanation
Among the possible outcomes of rolling the die twice, only meet the condition. Therefore, the answer is .
Constraints
For of the testdata, is , respectively.
For another of the testdata, .
For of the testdata, and .
Translated by ChatGPT 5
京公网安备 11011102002149号