## Algorithm

Problem Name: 2 AD-HOC - beecrowd | 1849

# Dracarys!

By M.C. Pinto, UNILA 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.

## Input

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.

## Output

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 4

 1 1 2 1 1

 2 4 3 4 16

## Code Examples

### #1 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include <bits/stdc++.h>

using namespace std;

int main()
{
int a, b, c, d;

while (cin >> a >> b >> c >> d)
{
int e = min(a, b);
int f = min(c, d);

e += f;
int g = min(max(a, b), max(c, d));

int h = min(e, g);

cout << h * h << '\n';
}
}
``````
Copy The Code &

Input

cmd
1 2 2 1

Output

cmd
4