5468.Axis-Aligned Area

Time Limit: 1s Memory Limit: 256MB

Alex has four sticks with positive integer lengths $a_1$, $a_2$, $a_3$, and $a_4$ ($a_1 \le a_2 \le a_3 \le a_4$).

She wants to place them on a plane in such a way that each stick is parallel to one of the two coordinate axes, and the area enclosed by these sticks is as large as possible.

Find this maximum enclosed area.

Input Format(From the terminal/stdin)

The input contains four positive integers $a_1$, $a_2$, $a_3$, and $a_4$, each on a separate line, denoting the lengths of the sticks in non-decreasing order ($1 \le a_1 \le a_2 \le a_3 \le a_4 \le 100$).

Output Format(To the terminal/stdout)

Print the maximum area that can be enclosed.

Sample Input 1

Copy
2
2
4
7
 \n
 \n
 \n
 \n

Sample Output 1

Copy
8
 \n

Sample Input 2

Copy
10
10
10
10
  \n
  \n
  \n
  \n

Sample Output 2

Copy
100
   \n

Hints

Here is one optimal way to place the sticks on the plane for the first example:
G4ew7YKR3NuSZeh0daMvxbTdvgckUjKINrkkzpqQ.png
The enclosed area is shaded in gray.

Source: NWRRC 2023

Submit

请先 登录

© 2025 FAQs