Container With Most Water#11247

Container With Most Water

1 second
128 megabytes
Very easy

There is an array of integers of length , representing the heights of vertical lines. For each -th line, its endpoints are defined by the coordinates and (i, h_i).

Find two lines that, together with the -axis, form a container capable of holding the maximum amount of water.

Input

The first line contains the size n~(n \leq 10^5) of the array . The second line contains positive integers — the elements of the array , each of which does not exceed 10^9.

Output

Print the maximum volume of water that the container can hold.

Examples

Example 1

Loading
Loading