Under construction

Still being built. Things may change

Sowing Work

Interview

Time limit2sMemory limit1024 MB

Summary
Given a w by h garden, find the maximum total area covered by one or two non-overlapping axis-aligned integer squares.
Level

Medium4 of 10

Topics
Math, Greedy
Solved
No attempts yet

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 w×hw \times h, where ww and hh 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 ww and hh (1≤w,h≤1091 \leq w, h \leq 10^9), 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 2×22 \times 2 square, which covers the entire garden. In the second example, he uses one 3×33 \times 3 square and places one 1×11 \times 1 square in the remaining strip.

Examples2

  1. Example 1

    Input
    2 2
    
    Expected output
    4
    
  2. Example 2

    Input
    4 3
    
    Expected output
    10