100 atcoder#ABC189C. [ABC189C] Mandarin Orange
[ABC189C] Mandarin Orange
Score : points
Problem Statement
There are dishes arranged in a row in front of Takahashi. The -th dish from the left has oranges on it.
Takahashi will choose a triple of integers satisfying all of the following conditions:
- ;
- ;
- for every integer between and (inclusive), .
He will then pick up and eat oranges from each of the -th through -th dishes from the left.
At most how many oranges can he eat by choosing the triple to maximize this number?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum number of oranges Takahashi can eat.
6
2 4 4 9 4 9
20
By choosing , he can eat oranges.
6
200 4 4 9 4 9
200
By choosing , he can eat oranges.