#P1389B. Array Walk
Array Walk
No submission language available for this problem.
Description
You are given an array , consisting of positive integers.
Initially you are standing at index and have a score equal to . You can perform two kinds of moves:
- move right — go from your current index to and add to your score. This move can only be performed if .
- move left — go from your current index to and add to your score. This move can only be performed if . Also, you can't perform two or more moves to the left in a row.
You want to perform exactly moves. Also, there should be no more than moves to the left among them.
What is the maximum score you can achieve?
The first line contains a single integer () — the number of testcases.
The first line of each testcase contains three integers and (, , ) — the number of elements in the array, the total number of moves you should perform and the maximum number of moves to the left you can perform.
The second line of each testcase contains integers () — the given array.
The sum of over all testcases does not exceed .
Print integers — for each testcase output the maximum score you can achieve if you make exactly moves in total, no more than of them are to the left and there are no two or more moves to the left in a row.
Input
The first line contains a single integer () — the number of testcases.
The first line of each testcase contains three integers and (, , ) — the number of elements in the array, the total number of moves you should perform and the maximum number of moves to the left you can perform.
The second line of each testcase contains integers () — the given array.
The sum of over all testcases does not exceed .
Output
Print integers — for each testcase output the maximum score you can achieve if you make exactly moves in total, no more than of them are to the left and there are no two or more moves to the left in a row.
Samples
Note
In the first testcase you are not allowed to move left at all. So you make four moves to the right and obtain the score .
In the second example you can move one time to the left. So we can follow these moves: right, right, left, right. The score will be .
In the third example you can move four times to the left but it's not optimal anyway, you can just move four times to the right and obtain the score .