#P1389B. Array Walk

    ID: 5491 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>brute forcedpgreedy*1600

Array Walk

No submission language available for this problem.

Description

You are given an array a1,a2,,ana_1, a_2, \dots, a_n, consisting of nn positive integers.

Initially you are standing at index 11 and have a score equal to a1a_1. You can perform two kinds of moves:

  1. move right — go from your current index xx to x+1x+1 and add ax+1a_{x+1} to your score. This move can only be performed if x<nx<n.
  2. move left — go from your current index xx to x1x-1 and add ax1a_{x-1} to your score. This move can only be performed if x>1x>1. Also, you can't perform two or more moves to the left in a row.

You want to perform exactly kk moves. Also, there should be no more than zz moves to the left among them.

What is the maximum score you can achieve?

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of testcases.

The first line of each testcase contains three integers n,kn, k and zz (2n1052 \le n \le 10^5, 1kn11 \le k \le n - 1, 0zmin(5,k)0 \le z \le min(5, k)) — 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 nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1041 \le a_i \le 10^4) — the given array.

The sum of nn over all testcases does not exceed 31053 \cdot 10^5.

Print tt integers — for each testcase output the maximum score you can achieve if you make exactly kk moves in total, no more than zz 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 tt (1t1041 \le t \le 10^4) — the number of testcases.

The first line of each testcase contains three integers n,kn, k and zz (2n1052 \le n \le 10^5, 1kn11 \le k \le n - 1, 0zmin(5,k)0 \le z \le min(5, k)) — 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 nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1041 \le a_i \le 10^4) — the given array.

The sum of nn over all testcases does not exceed 31053 \cdot 10^5.

Output

Print tt integers — for each testcase output the maximum score you can achieve if you make exactly kk moves in total, no more than zz of them are to the left and there are no two or more moves to the left in a row.

Samples

Sample Input 1

4
5 4 0
1 5 4 3 2
5 4 1
1 5 4 3 2
5 4 4
10 20 30 40 50
10 7 3
4 6 8 2 9 9 7 4 10 9

Sample Output 1

15
19
150
56

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 a1+a2+a3+a4+a5a_1 + a_2 + a_3 + a_4 + a_5.

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 a1+a2+a3+a2+a3a_1 + a_2 + a_3 + a_2 + a_3.

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 a1+a2+a3+a4+a5a_1 + a_2 + a_3 + a_4 + a_5.