P2260 {{[Tsinghua Training 2012] Sum of Modular Products}}

Background

{{A mathematics problem, no background.}}

Description

{{Compute $$\sum_{i=1}^{n} \sum_{j=1}^{m} (n \bmod i) \times (m \bmod j), i \neq j$$ the value modulo 19940417.}}

Input Format

{{The input contains a single line with two integers $n$, $m$.}}

Output Format

{{The answer modulo 19940417.}}

Explanation/Hint

{{Constraints - For 10% of the testdata, it is guaranteed that $n, m \le 10^3$. - For 30% of the testdata, it is guaranteed that $n, m \le 10^6$. - For another 30% of the testdata, it is guaranteed that $n \le 100$. - For 100% of the testdata, it is guaranteed that $1 \le n, m \le 10^9$.}} Translated by ChatGPT 5