The Little Elephant and his friends from the Zoo of Lviv were returning from the party. But suddenly they were stopped by the policeman Big Hippo, who wanted to make an alcohol test for elephants.
There were N elephants ordered from the left to the right in a row and numbered from 0 to N-1. Let R[i] to be the result of breathalyzer test of i-th elephant.
Considering current laws in the Zoo, elephants would be arrested if there exists K consecutive elephants among them for which at least M of these K elephants have the maximal test result among these K elephants.
Using poor math notations we can alternatively define this as follows. The elephants would be arrested if there exists i from 0 to N-K, inclusive, such that for at least M different values of j from i to i+K-1, inclusive, we have R[j] = max{R[i], R[i+1], ..., R[i+K-1]}.

The Big Hippo is very old and the Little Elephant can change some of the results. In a single operation he can add 1 to the result of any elephant. But for each of the elephants he can apply this operation at most once.
What is the minimum number of operations that the Little Elephant needs to apply, such that the sequence of results, after all operations will be applied, let elephants to avoid the arrest? If it is impossible to avoid the arrest applying any number of operations, output -1.

Input
 The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains three space-separated integers N, K, M. The second line contains N space-separated integers  R[0], R[1], ..., R[N-1] denoting the test results of the elephants.

Output
For each test case, output a single line containing the minimum number of operations needed to avoid the arrest.

Constraints
1 ≤ T ≤ 10
1 ≤ M ≤ K ≤ N ≤ 17
1 ≤ R[i] ≤ 17

Example

Input:
4
5 3 2
1 3 1 2 1
5 3 3
7 7 7 7 7
5 3 3
7 7 7 8 8
4 3 1
1 3 1 2

Output:
0
1
1
-1


Explanation
Example case 1. Let's follow the poor math definition of arrest. We will consider all values of i from 0 to N-K = 2, inclusive, and should count the number of values of j described in the definition. If it less than M = 2 then this value of i does not cause the arrest, otherwise causes.


i
{R[i],...,R[i+K-1]}
max{R[i],...,R[i+K-1]}
For which j = i, ..., i+K-1 we have R[j] = max
Conclusion


i=0
{1, 3, 1}
max = 3
R[j] = 3 for j = 1
does not cause the arrest


i=1
{3, 1, 2}
max = 3
R[j] = 3 for j = 1
does not cause the arrest


i=2
{1, 2, 1}
max = 2
R[j] = 2 for j = 3
does not cause the arrest


So we see that initial test results of the elephants do not cause their arrest. Hence the Little Elephant does not need to apply any operations. Therefore, the answer is 0.
Example case 2.We have N = 5, K = 3, M = 3. Let's construct similar table as in example case 1. Here the value of i will cause the arrest if we have at least 3 values of j described in the definition.


i
{R[i],...,R[i+K-1]}
max{R[i],...,R[i+K-1]}
For which j = i, ..., i+K-1 we have R[j] = max
Conclusion


i=0
{7, 7, 7}
max = 7
R[j] = 7 for j = 0, 1, 2
causes the arrest


i=1
{7, 7, 7}
max = 7
R[j] = 7 for j = 1, 2, 3
causes the arrest


i=2
{7, 7, 7}
max = 7
R[j] = 7 for j = 2, 3, 4
causes the arrest


So we see that for initial test results of the elephants each value of i causes their arrest. Hence the Little Elephant needs to apply some operations in order to avoid the arrest. He could achieve his goal by adding 1 to the result R[2]. Then results will be {R[0], R[1], R[2], R[3], R[4]} = {7, 7, 8, 7, 7}. Let's check that now elephants will be not arrested.


i
{R[i],...,R[i+K-1]}
max{R[i],...,R[i+K-1]}
For which j = i, ..., i+K-1 we have R[j] = max
Conclusion


i=0
{7, 7, 8}
max = 8
R[j] = 8 for j = 2
does not cause the arrest


i=1
{7, 8, 7}
max = 8
R[j] = 8 for j = 2
does not cause the arrest


i=2
{8, 7, 7}
max = 8
R[j] = 8 for j = 2
does not cause the arrest


So we see that now test results of the elephants do not cause their arrest. Thus we see that using 0 operations we can't avoid the arrest but using 1 operation can. Hence the answer is 1.
Example case 3.We have N = 5, K = 3, M = 3. Let's construct similar table as in example case 1. Here the value of i will cause the arrest if we have at least 3 values of j described in the definition.


i
{R[i],...,R[i+K-1]}
max{R[i],...,R[i+K-1]}
For which j = i, ..., i+K-1 we have R[j] = max
Conclusion


i=0
{7, 7, 7}
max = 7
R[j] = 7 for j = 0, 1, 2
causes the arrest


i=1
{7, 7, 8}
max = 8
R[j] = 8 for j = 3
does not cause the arrest


i=2
{7, 8, 8}
max = 8
R[j] = 8 for j = 3, 4
does not cause the arrest


So we see that for initial test results of the elephants the value of i = 0 causes their arrest. Hence the Little Elephant needs to apply some operations in order to avoid the arrest. He could achieve his goal by adding 1 to the result R[1]. Then results will be {R[0], R[1], R[2], R[3], R[4]} = {7, 8, 7, 8, 8}. Let's check that now elephants will be not arrested.


i
{R[i],...,R[i+K-1]}
max{R[i],...,R[i+K-1]}
For which j = i, ..., i+K-1 we have R[j] = max
Conclusion


i=0
{7, 8, 7}
max = 8
R[j] = 8 for j = 1
does not cause the arrest


i=1
{8, 7, 8}
max = 8
R[j] = 8 for j = 1, 3
does not cause the arrest


i=2
{7, 8, 8}
max = 8
R[j] = 8 for j = 3, 4
does not cause the arrest


So we see that now test results of the elephants do not cause their arrest. Thus we see that using 0 operations we can't avoid the arrest but using 1 operation can. Hence the answer is 1. Note that if we increase by 1 the result R[2] instead of R[1] then the value i = 2 will cause the arrest since {R[2], R[3], R[4]} will be {8, 8, 8} after this operation and we will have 3 values of j from 2 to 4, inclusive, for which R[j] = max{R[2], R[3], R[4]}, namely, j = 2, 3, 4.
Example case 4. When M = 1 the Little Elephant can't reach the goal since for each value of i from 0 to N-K we have at least one value of j for which R[j] = max{R[i], R[i+1], ..., R[i+K-1]}.
#!/usr/bin/python
from sys import stdin

T = int(stdin.readline())
global N,K,M,R
global minimal

def check(i,current):
    global N,K,M,R
    global minimal
    #print current,minimal,i,R
    if current >= minimal:
        return
    if i >= N:
        if current < minimal:
            minimal = current
        return


    #print current,R
    for add in [0,1]:
        R[i] += add

        if i >= K - 1:
            start = 1 + min(i - K, N - K)
            end   = start + K
            #print start, end
            high = R[start]
            start += 1
            count = 1
            while start < end:
                if R[start] == high:
                    count += 1
                elif R[start] > high:
                    high = R[start]
                    count = 1
                start += 1
        else:
            count = 0
        if count < M:
            check(i+1, current + add)
            if minimal == 0:return
        R[i] -= add

#T = 1
for _ in xrange(T):
    N,K,M = (int(x) for x in stdin.readline().split())
    R = [int(x) for x in stdin.readline().split()]
    current = 0
    minimal = N+1
    if M == 0:
        minimal = 0
    elif M != 1:
        check(0,0)
    if minimal == N+1:
        print '-1'
    else:
        print minimal