Sowing Work
InterviewTime limit2sMemory limit1024 MB
Given a w by h garden, find the maximum total area covered by one or two non-overlapping axis-aligned integer squares.
Problem
It is early spring. Bombozlav has just received a diploma from the final stage of the Open Olympiad in Informatics and is now at the country house, helping his grandfather Pafnutiy Maksimovich sow the vegetable garden.
The garden is a rectangle of size , where and are integers. This year Pafnutiy Maksimovich plans to sow turnips and radishes. For each plant he wants to set aside a square area of the garden with an integer side length. The sides of each square must be parallel to the sides of the garden. The squares may have different sizes, but they must not extend beyond the garden and must not overlap with positive area.
Bombozlav wants to show his grandfather that the diploma was earned. He wants to compute the maximum area of the garden that can be sown this way. Since his grandfather likes radishes more than turnips, he may skip turnips entirely and use only one square if that covers a larger area.
Input
The only line contains two integers and (), the dimensions of the garden.
Output
Print one integer, the maximum total area that can be sown using one or two square areas as described.
Hints
In the first example, Bombozlav can use one square, which covers the entire garden. In the second example, he uses one square and places one square in the remaining strip.