atcoder#AGC049D. [AGC049D] Convex Sequence
[AGC049D] Convex Sequence
Score : points
Problem Statement
Given are integers and . Find the number, modulo , of length- sequences that consist of non-negative integers and satisfy the following conditions:
- ;
- For every (), .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number, modulo , of sequences that satisfy the conditions.
3 3
7
The following seven sequences satisfy the conditions.
10 100
10804516
10000 100000
694681734