#P15711. [JAG 2023 Summer Camp #2] Tea time in the grand garden
[JAG 2023 Summer Camp #2] Tea time in the grand garden
题目描述
Appropriate temperature changes are essential for brewing delicious tea. Noli has been taught a recipe for delicious tea.
The recipe is represented by a sequence of non-negative integers of length . She must change the temperature accordingly.
Raising the temperature is hard work. The cost of a recipe is defined by the following .
Noli has forgotten the recipe she was taught. All she remembers is that and that the cost was .
How many possible recipes can be considered? Find the remainder of the number of possible recipes divided by .
Note that two recipes are different when the values of are different for any .
输入格式
The input satisfies the following constraints.
- All inputs consist of integers.
输出格式
Output the remainder of the number of possible recipes divided by . Add a new line at the end of the output.
2 2
5
100 0
1
300 300
527212271
200000 200000
885086300
提示
In Sample Input 1, There are five possible sequences .