atcoder#ABC279H. [ABC279Ex] Sum of Prod of Min
[ABC279Ex] Sum of Prod of Min
Score : points
Problem Statement
You are given positive integers and . Here, it is guaranteed that .
Print the sum, modulo (a prime), of the following value over all sequences of positive integers such that (notice the unusual modulo):
- .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
3 5
14
There are six sequences that satisfy the condition: $S=(1,1,3), S=(1,2,2), S=(1,3,1), S=(2,1,2), S=(2,2,1), S=(3,1,1)$.
The value for each of those is as follows.
- :
- :
- :
- :
- :
- :
Thus, you should print their sum: .
1126 2022
40166
Print the sum modulo .
1000000000000 1500000000000
180030