P10636 BZOJ3518 Point Set Counting.
Description
There is an $n \times m$ lattice of points on the plane, as shown in the following figure for a $3 \times 4$ lattice:

Now ask: how many unordered triples of points $(a,b,c)$ satisfy that points $a,b,c$ are collinear. The order does not matter; for example, $(a,b,c)$ and $(b,c,a)$ are considered the same triple. Output the answer modulo $10^9+7$.
## Constraints
Compute the answer modulo $10^9+7$.
Input Format
One line with two positive integers $n,m$.
Output Format
One line with one integer, the result after taking modulo $10^9+7$.
Explanation/Hint
The testdata guarantees that $1\leq n,m\leq 5\times 10^4$.
Translated by ChatGPT 5