Time limit
2s
Memory limit
128 MB
All integer lattice points with coordinates 0 ≤ x ≤ N and 0 ≤ y ≤ M are given. Choose three distinct points. They form a triangle only when the area is positive.
Count how many different triangles can be formed. When N=1 and M=2, the answer is 18.
The first line contains two integers N and M.
Print the number of possible triangles on the first line.
1 ≤ N, M ≤ 1,000