#abc279h. Ex - Sum of Prod of Min
Ex - Sum of Prod of Min
Score : points
问题描述
给定正整数 和 ,其中保证 。
计算满足以下条件的所有正整数序列 的下述值之和,并对结果取模 (一个质数):
- (注意此处的特殊模运算)。
以上为通义千问 qwen-max 翻译,仅供参考。
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.
Sample Input 1
3 5
Sample Output 1
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: .
Sample Input 2
1126 2022
Sample Output 2
40166
Print the sum modulo .
Sample Input 3
1000000000000 1500000000000
Sample Output 3
180030
update @ 2024/3/10 11:45:33