#P2106. Sam 数
Sam 数
Description
Xiao Z recently discovered a very interesting type of number, which he calls a Sam number.
Sam numbers have the following property: the difference between any two adjacent digits does not exceed .
Xiao Z also classifies Sam numbers by their number of digits. He calls a -digit Sam number a -order Sam number.
Unfortunately, Xiao Z cannot figure out how many -order Sam numbers there are, so he turns to you for help.
The answer should be taken modulo .
Input Format
The input contains a single integer , as described above.
Output Format
Output a single integer , the number of -order Sam numbers.
The answer should be taken modulo .
4
867
Hint
Constraints:
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号