Picnic Rhombi
Time limit2sMemory limit128 MB
Count every rhombus whose four vertices sit on lattice points of an N by M grid of unit squares.
- Level
Hard8 of 10
- Topics
- Combinatorics, Geometry, Math, Number theory
- Solved
- No attempts yet
Problem
A group of people on a picnic divides a wide lawn into an N x M grid. The grid consists of unit squares of size 1 x 1.
You want to draw rhombi on this grid. All four vertices of a rhombus must lie on vertices of the unit squares, that is, on lattice points of the grid. Squares are included because all four of their sides have the same length.
Given N and M, find the number of different rhombi that can be drawn. Two rhombi are different if their sets of vertices differ by at least one point.
Input
The first line contains two integers N and M.
Output
Print the number of different rhombi that can be drawn.
Constraints
1 <= N, M <= 100