A n * m grid as follow:
a n*m grid(n=4,m=3)
Count the number of triangles, three of whose vertice must be grid-points.
Note that the three vertice of the triangle must not be in a line(the right picture is not a triangle).
a triangle not a triangle
Input
The input consists of several cases. Each case consists of two positive integers n and m (1 ≤ n, m ≤ 1000).
Output
For each case, output the total number of triangle.
Sample Input
1 1
2 2
Sample Output
4
76
hint
hint for 2nd case: C(9, 3) - 8 = 76
http://www.2cto.com/kf/201411/348407.html
http://blog.csdn.net/loy_184548/article/details/45622473?locationNum=4