Problem hidden
CONCAVE - Concave quadrilaterals
Given is a grid consisting of r rows by c columns of grid points.
Count the number of ways in which it is possible to draw a strictly concave quadrilateral with vertices in four of the given grid points.
(A quadrilateral is strictly concave if and only if one of its two diagonals contains a point that is strictly outside the quadrilateral. Shifted and/or rotated copies of the same quadrilateral count as distinct ways of drawing it.)
Input specification
The input has a single line with the two integers r and c.
You may assume that the total number of grid points is at most 3000.
Output specification
Output a single line with a single integer: the number of concave quadrilaterals with vertices on the grid.
Examples
input
2 10 |
output
0 |
input
3 3 |
output
24 |
Added by: | Xellos |
Date: | 2011-12-30 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | people.ksp.sk/~acm, ACM ICPC selection round of Comenius University |