Construction#5226

Construction

0.5 seconds
16 megabytes
Easy

Watson needs to construct the most effective neural network. He is provided with a board containing chips, placed in a line with a distance of cm between adjacent chips. Each chip has its own performance value, expressed by an integer. Watson can build any number of neurons using these chips; each chip can be used in at most one neuron. A neuron is formed by connecting two chips that are exactly cm apart. The effectiveness of a neuron is the sum of the performance values of its two chips. The effectiveness of a neural network is the sum of the effectiveness values of all its neurons. The neural network may consist of any number of neurons, including zero.

Input

The first line contains two integers and .

The second line contains integers A_i — the performance values of the chips.

1 \leq N, M \leq 10^5
-10^6 < A_i < 10^6

Output

Output the maximum effectiveness of a neural network that can be constructed using the chips on the board.

Examples

Example 1

Loading
Loading