#P6262. [集训队互测 2019] 神树大人挥动魔杖
[集训队互测 2019] 神树大人挥动魔杖
Description
There is a row of cells and people, all starting at cell .
Each person may choose to jump forward by cell or by cells. The number of ways to make a -cell jump is , and the number of ways to make a -cell jump is . Once a person jumps out of the cells, they stop. Note that even on cell , one can still choose to jump by or cells.
You need to compute how many ways there are such that every cell is stepped on by at least one person.
Input Format
The first line contains four integers .
Output Format
Output the answer modulo .
10 3 5 6
273459417
2 1 3 4
21
20010910 666 1 1
773849796
Hint
Constraints and Conventions
- For of the testdata, , , and .
The limits for each subtask are as follows:
- Subtask ( points): , ;
- Subtask ( points): ;
- Subtask ( points): ;
- Subtask ( points): , , ;
- Subtask ( points): no special limits.
Translated by ChatGPT 5
京公网安备 11011102002149号