Positive Area Triangles

forthright48 NSU Code Masters 2016
Limits 2s, 512 MB

Given a grid with length X and height Y, we can select any lattice point ( lattice point = integer coordinates ) having coordinate (x,y) where 0 <= x <= X and 0 <= y <= Y.

In how many ways can we select 3 points such that the area of the triangle formed by the three points have positive area?

The order of the points does not matter, i.e, the selection of points in unordered.

Print the result modulo 10^9 + 7.


Input contains two integers, X and Y.

0 <= X, Y <= 3000


Print the number of unordered selection of 3 points that results in a triangle with positive area, modulo 10^9+7.


2 2


Login to submit.


0% Solution Ratio
Toph uses cookies. By continuing you agree to our Cookie Policy.