atcoder#ABC154F. [ABC154F] Many Many Paths
[ABC154F] Many Many Paths
Score : points
Problem Statement
Snuke is standing on a two-dimensional plane. In one operation, he can move by in the positive -direction, or move by in the positive -direction.
Let us define a function as follows:
- (The number of paths from the point to the point that Snuke can trace by repeating the operation above)
Given are integers , , , and . Find the sum of over all pair of integers such that and , and compute this value modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the sum of modulo .
1 1 2 2
14
For example, there are two paths from the point to the point : → → and → → , so .
Similarly, , , and . Thus, the sum is .
314 159 2653 589
602215194