#P3176. [HAOI2015] 数字串拆分
[HAOI2015] 数字串拆分
Description
You have a digit string of length .
Define as the number of ways to split into a sum of numbers in the range . For example, when , , namely .
Define as follows: split the digit string into several numbers (leading are allowed), let their sum be , then is the sum of over all such cases. For example, .
Given and , compute .
Take the answer modulo .
Input Format
The first line contains a string, which represents .
The second line contains an integer, which represents .
Output Format
Output a single integer representing the answer.
123
3
394608467
Hint
Constraints and Conventions
- For of the testdata, it is guaranteed that , , and contains only digit characters.
Translated by ChatGPT 5
京公网安备 11011102002149号