URI Online Judge | 1849


By M.C. Pinto, UNILA BR Brazil

Timelimit: 1

Daenerys Targaryen, the Stormborn, has 3 dragons: Drogon, Viserion e Rhaegal. She uses them frequently at battles and makes them spit fire by saying "Dracarys!".

It turns out that when the dragons spit fire on a plane surface, the fire always burns a rectangular area. The dimensions of these areas depend on several factors, but Daenerys can state precisely what are the rectangle's width and length that will be burned by Drogon and by Viserion.

Daenerys demands your assistance to indicate what is the biggest possible square size that can be burned given the rectangle's dimensions that Drogon and Viserion can burn.


The input has 4 positive integers LD, CD, LV, CV separated by space, indicating, respectively, the width and length of the rectangle to be burned by Drogon and the width and length of the rectangle to be burned by Viserion. None of these integers exceeds the 10000 value.


The output should be a number A, indicating the area of the larger possible square to be formed with the two given rectangles.

Input Samples Output Samples

1 2 2 1


1 1 2 1


2 4 3 4