#agc045c. [agc045_c]Range Set
[agc045_c]Range Set
Problem Statement
Snuke has a string of length . Initially, every character in is 0
.
Snuke can do the following two operations any number of times in any order:
- Choose consecutive characters in and replace each of them with
0
. - Choose consecutive characters in and replace each of them with
1
.
Find the number of different strings that can be after Snuke finishes doing operations. This count can be enormous, so compute it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of different strings that can be after Snuke finishes doing operations, modulo .
Sample Input 1
4 2 3
Sample Output 1
11
For example, can be 0011
or 1111
in the end, but cannot be 0110
.
Sample Input 2
10 7 2
Sample Output 2
533
Sample Input 3
1000 100 10
Sample Output 3
828178524