Problems
Construction
Construction
Watson needs to construct most effective neural network. He is provided with a board containing \textbf{N} chips; chips are located in a line at distance 1 cm from each other. Each chip has its own performance, expressed by an integer. Watson is able to construct any number of neurons using these chips; every chip can be used not more than in one neuron. Neuron can be obtained by connecting two chips, which are located at distance \textbf{M} cm one from another. Effectiveness of a neuron is a sum of performances of chips it consists of. Effectiveness of neural network is a sum of effectivenesses of neurons. Neural network can contain any number of neurons, even \textbf{0}.
\InputFile
The first line contains two integers \textbf{N} and \textbf{M}.
The second line contains \textbf{N} integers \textbf{A_i} -- performances of chips.
\textbf{1} ≤ \textbf{N}, \textbf{M} ≤ \textbf{10^5}, \textbf{-10^6} < \textbf{A_i} < \textbf{10^6}
\OutputFile
The highest effectiveness of neural network built on the board with chips.
Input example #1
8 3 3 1 4 1 5 9 2 6
Output example #1
28
Example description: We can link chips in pairs in this way: 1-4, 3-6, 5-8. Which will give effectiveness: (3 + 1) + (4 + 9) + (5 + 6).