#P10636. BZOJ3518 点组计数
BZOJ3518 点组计数
Problem Description
There is an lattice of points on the plane, as shown in the following figure for a lattice:

Now ask: how many unordered triples of points satisfy that points are collinear. The order does not matter; for example, and are considered the same triple. Output the answer modulo .
Constraints
Compute the answer modulo .
Input Format
One line with two positive integers .
Output Format
One line with one integer, the result after taking modulo .
3 4
20
Hint
The testdata guarantees that .
Translated by ChatGPT 5