Yellow Jackets - 2017 - Practice #3

Start

2017-09-13 23:10 CEST

Yellow Jackets - 2017 - Practice #3

End

2017-09-14 00:10 CEST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -11 days 16:17:05

Time elapsed

1:00:00

Time remaining

0:00:00

Problem D
Kornislav

Kornislav the turtle never has anything interesting to do. Since he’s going to live for three hundred years, he keeps trying to find way to kill time. This weekend he started playing "enclose the largest rectangle".

To start with, Kornislav needs four positive integers. He tries to enclose a rectangle by moving in one direction, then turning 90 degrees, then walking in the new direction etc. Kornislav makes a total of three 90-degree turns and walks four segments.

When walking in some direction, the number of steps he takes must be equal to one of the four chosen integers and each integer must be used exactly once. Depending on the order in which Kornislav uses the integers, his walk will make various shapes, some of which don’t contain enclosed rectangles. Write a program that calculates the largest rectangle the turtle can enclose with its walk.

Input

The first line contains four positive integers $A, B, C$ and $D~ (0 < A, B, C, D < 100)$, the four chosen integers.

Output

Output the largest area.

Sample Input 1 Sample Output 1
1 2 3 4
3
Sample Input 2 Sample Output 2
4 4 3 4
12