Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 3647
Gao the Grid

Time Limit: 2 Seconds      Memory Limit: 65536 KB

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


Author: WU, Yingxin
Submit    Status