logo AlgoBeat OnlineJudge
登录 注册

#215767. [JAG 2023 Summer Camp #2] Tea time in the grand garden

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

样例

样例输入 1

2 2

样例输出 1

5

样例输入 2

100 0 

样例输出 2

1

样例输入 3

300 300

样例输出 3

527212271

样例输入 4

200000 200000

样例输出 4

885086300

数据范围与提示

In Sample Input 1, There are five possible sequences .