Rectangles 2
Memory limit: 32 MB
How many rectangles can you find in the figure below?
We have found: 6 rectangles , 4 rectangles ,
3 rectangles , 2 rectangles , 2 rectangles
and one rectangle , what gives 18\ in total.
Clearly, we are interested in rectangles with vertices in grid points,
i.e., the points located at the intersections of vertical and horizontal
line segments, and having vertical or horizontal sides.
The above grid has dimensions .
And how many such rectangles of perimeter at least 6 can be found in
the figure?
You can find the answer in the Example section.
Input
The first and only line of the standard input contains three integers:
, and (, ),
representing the dimensions of the grid and the lower bound for the
perimeter of the rectangles.
Output
In the first line of the standard output your program should output
one integer: the number of rectangles
with vertices in grid points of the grid , having vertical
or horizontal sides and which perimeter is at least .
Example
For the input data:
3 2 4
the correct result is:
18
and for the input data:
3 2 6
the correct result is:
12
Task author: Jakub Radoszewski.