Hanging Christmas garlands is a surprisingly demanding job. A garland consists of n pieces of equal length. Because of decorations such as Christmas balls, piece i has its own weight wi.
The garland is attached to the ceiling at m spots. Its very beginning is attached to spot 1 and its end to spot m. It is also hooked to the remaining spots, which splits it into segments, each made of several consecutive pieces. Every decorator must respect the following rules.
The picture below shows one optimal hanging of a garland with twelve pieces in three segments; the weight of each piece is written inside its circle.

The first line contains a positive integer Z (Z≤50), the number of test cases. Then Z test cases follow.
Each garland is described by two lines. The first line contains three positive integers n, m, and d (1≤n≤40000, 2≤m≤10000, 1≤d≤10000), as described above. The second line contains n positive integers w1,w2,…,wn (1≤wi≤10000), the weights of the pieces.
For each garland, output a single line with one integer: the weight of the heaviest half-segment in an optimal attachment. If it is impossible to hang the garland while satisfying rules 1 and 2, output the word BAD instead.