#P1829. Sum of Least Common Multiples in a Table
Sum of Least Common Multiples in a Table
Sum of Least Common Multiples in a Table
In this problem, you are given two positive integers n and m. Consider an n × m table where the entry in the i-th row and j-th column is \(\mathrm{lcm}(i,j)\), the least common multiple of i and j.
Your task is to compute the sum of all numbers written in the table, and output the result modulo 20101009.
Recall that for two positive integers \(a\) and \(b\), the least common multiple \(\mathrm{lcm}(a, b)\) is the smallest positive integer that is a multiple of both \(a\) and \(b\). For example, \(\mathrm{lcm}(6, 8) = 24\).
Input Constraints: The values for n and m may be large, so an efficient solution is required.
inputFormat
The input consists of a single line containing two space-separated integers n and m.
outputFormat
Output a single integer, the sum of all \(\mathrm{lcm}(i, j)\) for \(1 \le i \le n\) and \(1 \le j \le m\), taken modulo 20101009.
sample
2 2
7