P28546 [洛谷] [Tsinghua Training 2012] Modulo Product Sum
提高+
题目描述

Problem Description

Calculate the value of

$$\sum_{i=1}^{n} \sum_{j=1}^{m} (n \bmod i) \times (m \bmod j), i \neq j$$

modulo 19940417.

Input Format

The input consists of a single line with two integers $n$ and $m$.

Output Format

Output the answer modulo 19940417.

Sample Input and Output

Sample Input #1

3 4

Sample Output #1

1

Sample Input #2

123456 654321

Sample Output #2

116430

Notes

Data Size and Constraints

  • For $10\%$ of the data, $n, m \leq 10^3$.
  • For $30\%$ of the data, $n, m \leq 10^6$.
  • For another $30\%$ of the data, $n \leq 100$.
  • For $100\%$ of the data, $1 \leq n, m \leq 10^9$.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 4
样例输出
1