You are going to select zero or more elements of so that: if you select , then in any interval of length (formally, in for any ) you can select at most elements.
Calculate the maximal sum of the elements you select.
输入格式
The first line contains an integer ().
The second line contains integers ().
输出格式
Output a single integer denoting the answer.
样例
样例输入 1
4
1 4 3 2
样例输出 1
7
样例输入 2
3
-10 -10 -10
样例输出 2
0
数据范围与提示
Source: The 2022 ICPC Asia Xi'an Regional Contest Problem J.