1021 - The Maximum Subsequence with Bounded Length (small version)

Time Limit: 1s Memory Limit: 256MB

Submissions: 156 Solved: 61
Description

Given an array of integers A = a1, a2, ..., an, a subsequence of A is a sequence of continuous elements in A, that means a sequence of form ai, ai+1,..., aj (1 ≤  i  ≤  j ≤  n). The length of the subsequence is the number of its elements. The weight of the subsequence is the sum of all elements. A subsequence has the bounded length if its length is greater or equal to L1 and smaller or equal to L2.

Your task is to find the maximum weight subsequence of A with length bounded by L1 and L2.

Input

The fist line contains 4 positive integers n, L1, L2 (n ≤  10<sup>6</sup>, L1 ≤ L2 ≤ n).

The second line contains n integers a1, a2,..., an

Output
Print uniquely one integer which is the found weight.
Sample Input
6  3  4
3  5 -9  6  7  -4
Sample Output
9
Hint

The Maximum Subsequence with Bounded Length is 5, -9, 6, 7 having the weight 9.

Source