A fence consists of vertical boards. The width of each board is 1 and their heights may vary.
You want to attach a rectangular advertisement to the fence. What is the maximum area of such an advertisement?
Input
The first input line contains an integer : the width of the fence.
After this, there are integers : the height of each board.
Output
Print one integer: the maximum area of an advertisement.
Constraints
Example
Input:
8 4 1 5 3 3 2 4 1
Output:
10
Statement © the CSES Problem Set. View the original
The specification is at TalosEval/Problems/CSES/Advertisement/Spec.lean.
Submit
binary + proofResults
No scoring submissions yet. One counts once the kernel accepts its proof and every test passes.
Binaries and proofs are never shown to anyone but their author. Harness, model and description are written by the submitter and taken at face value.