J - Jungle Editorial

Time Limit: 8 sec / Memory Limit: 256 MB

Problem

Wolf Sothe owns a long land in the jungle. In this linear land, NN trees grow at regular intervals. The size of the ithi_{th} tree from one end is given as tit_i.

Inside the jungle it is dark because trees obstruct sunlight. In order to let sunlight shine into the jungle, Wolf Sothe considers cutting some of the NN trees (or cutting no one). More specifically, trees will be cut with the following rules.

  • Up to MM trees can be cut (no more than MM).
  • Considering the impact on the surrounding ecosystem, it is not allowed to cut two or more trees in arbitrary KK consecutive trees. More precisely, there is not i(1iNK+1)i(1≦i≦N-K+1) such that 22 or more trees are cut in the ithi_{th}, (i+1)th(i + 1)_{th}, ......, (i+K1)th(i + K-1)_{th} trees from one end.
  • If Wolf Sothe cuts the ithi_{th} tree from one end, the size of the tree tit_i becomes 00.
  • We want the maximum value of the sum of sizes of KK consecutive trees to be as small as possible. Namely, we want to minimize .

Since the size of the NN trees and MM, KK have been given, when we make the optimal cutting choice for the trees, please obtain the minimum value of the maximum value of the sum of sizes of consecutive KK trees.


Input

Inputs will be given by standard input in following format.

NN MM KK
t1t_1
t2t_2
:
tNt_N
  • At the first line, integer N(1N100,000)N(1≦N≦100,000), M(1MN)M(1≦M≦N), K(1KN)K(1≦K≦N) will be given.
  • From the second line there are NN additional lines to give information about sizes of trees. At the ithi_{th} line, integer ti(1ti1,000,000,000)t_i(1≦t_i≦1,000,000,000) will be given.

Output

Please print the minimum value of the maximum value of the sum of sizes of consecutive KK trees, when we made the optimal cutting choice for the trees in a line.

Print a newline at the end of output.


Input Example 1Copy

Copy
6 2 3
1
5
6
2
4
3

Output Example 1Copy

Copy
7

If Wolf Sothe cuts the 3rd3_{rd} and 6th6_{th} tree, the minimum value of the maximum value of the sum of sizes of consecutive 33 consecutive trees will be obtained when it is for the 2nd2_{nd}, 3rd3_{rd}, 4th4_{th} tree. The sum of sizes is 5+0+2=75+0+2=7.


Input Example 2Copy

Copy
10 3 4
3
14
1
5
9
2
6
5
3
5

Output Example 2Copy

Copy
17


2025-04-07 (Mon)
21:54:00 +00:00