Score : $300$ points
There are $N$ dishes arranged in a row in front of Takahashi. The $i$-th dish from the left has $A_i$ oranges on it.
Takahashi will choose a triple of integers $(l, r, x)$ satisfying all of the following conditions:
He will then pick up and eat $x$ oranges from each of the $l$-th through $r$-th dishes from the left.
At most how many oranges can he eat by choosing the triple $(l, r, x)$ to maximize this number?
Input is given from Standard Input in the following format:
$N$ $A_1$ $\ldots$ $A_N$
Print the maximum number of oranges Takahashi can eat.
6 2 4 4 9 4 9
20
By choosing $(l,r,x)=(2,6,4)$, he can eat $20$ oranges.
6 200 4 4 9 4 9
200
By choosing $(l,r,x)=(1,1,200)$, he can eat $200$ oranges.