#abc279h. Ex - Sum of Prod of Min

Ex - Sum of Prod of Min

Score : 600600 points

问题描述

给定正整数 NNMM,其中保证 NM2NN\leq M \leq 2N

计算满足以下条件的所有正整数序列 S=(S1,S2,,SN)S=(S_1,S_2,\dots,S_N) 的下述值之和,并对结果取模 200 003200\ 003(一个质数):

  • k=1Nmin(k,Sk)\displaystyle \prod_{k=1}^{N} \min(k,S_k) (注意此处的特殊模运算)。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given positive integers NN and MM. Here, it is guaranteed that NM2NN\leq M \leq 2N.

Print the sum, modulo 200 003200\ 003 (a prime), of the following value over all sequences of positive integers S=(S1,S2,,SN)S=(S_1,S_2,\dots,S_N) such that i=1NSi=M\displaystyle \sum_{i=1}^{N} S_i = M (notice the unusual modulo):

  • k=1Nmin(k,Sk)\displaystyle \prod_{k=1}^{N} \min(k,S_k).

Constraints

  • 1N10121 \leq N \leq 10^{12}
  • NM2NN \leq M \leq 2N
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN MM

Output

Print the answer as an integer.

Sample Input 1

3 5

Sample Output 1

14

There are six sequences SS 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 k=1Nmin(k,Sk)\displaystyle \prod_{k=1}^{N} \min(k,S_k) for each of those SS is as follows.

  • S=(1,1,3)S=(1,1,3) : 1×1×3=31\times 1 \times 3 = 3
  • S=(1,2,2)S=(1,2,2) : 1×2×2=41\times 2 \times 2 = 4
  • S=(1,3,1)S=(1,3,1) : 1×2×1=21\times 2 \times 1 = 2
  • S=(2,1,2)S=(2,1,2) : 1×1×2=21\times 1 \times 2 = 2
  • S=(2,2,1)S=(2,2,1) : 1×2×1=21\times 2 \times 1 = 2
  • S=(3,1,1)S=(3,1,1) : 1×1×1=11\times 1 \times 1 = 1

Thus, you should print their sum: 1414.

Sample Input 2

1126 2022

Sample Output 2

40166

Print the sum modulo 200 003200\ 003.

Sample Input 3

1000000000000 1500000000000

Sample Output 3

180030

update @ 2024/3/10 11:45:33