human
Can you solve the below in PYTHON?
A total of n depots are located on a number line. Depot i lies at the point x_i for 1 ≤ i ≤ n.

You are a salesman with n bags of goods, attempting to deliver one bag to each of the n depots. You and the n bags are initially at the origin 0. You can carry up to k bags at a time. You must collect the required number of goods from the origin, deliver them to the respective depots, and then return to the origin to collect your next batch of goods.

Calculate the minimum distance you need to cover to deliver all the bags of goods to the depots. You do not have to return to the origin after you have delivered all the bags.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 10 500). Description of the test cases follows.

The first line of each test case contains two integers n and k (1 ≤ k ≤ n ≤ 2 ⋅ 10^5).

The second line of each test case contains n integers x_1, x_2, …, x_n (-10^9 ≤ x_i ≤ 10^9). It is possible that some depots share the same position.

It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case, output a single integer denoting the minimum distance you need to cover to deliver all the bags of goods to the depots. 

Example

Input

4
5 1
1 2 3 4 5
9 3
-5 -10 -15 6 5 8 3 7 4
5 3
2 2 3 3 3
4 2
1000000000 1000000000 1000000000 1000000000

Output

25
41
7
3000000000

Note

In the first test case, you can carry only one bag at a time. Thus, the following is a solution sequence that gives a minimum travel distance: 0 → 2 → 0 → 4 → 0 → 3 → 0 → 1 → 0 → 5, where each 0 means you go the origin and grab one bag, and each positive integer means you deliver the bag to a depot at this coordinate, giving a total distance of 25 units. It must be noted that there are other sequences that give the same distance.

In the second test case, you can follow the following sequence, among multiple such sequences, to travel minimum distance: 0 → 6 → 8 → 7 → 0 → 5 → 4 → 3 → 0 → (-5) → (-10) → (-15), with distance...
 ... Give me a Python program to calculate the minimum distance you need to cover to deliver all the bags of goods to the depots?
assistant
#Here is Python program to calculate the minimum distance you need to cover to deliver all the bags of goods to the depots.

FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
 
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]
 
####
 
def solve(N, K, A):
    pos = []
    neg = []
    for x in A:
        if x > 0:
            pos.append(x)
        elif x < 0:
            neg.append(-x)
    pos.sort(reverse=True)
    neg.sort(reverse=True)

    def f(A, B):
        ans = 0
        for i in range(0, max(len(A),len(B)) + 1, K):
            if i < len(A):
                ans += A[i]
            if i < len(B):
                ans += B[i]
        return 2 * ans
    # try pos saving
    ans = float('inf')
    if pos:
        ans = f(pos[K:], neg) + pos[0]
    if neg:
        cand =  f(pos, neg[K:]) + neg[0]
        if cand < ans:ans=cand
    if not pos and not neg:
        return 0
    return ans

    

T = rri()
for _ in xrange(T):
    N,K = rrm()
    A = rrm()
    ans = solve(N, K, A)
    print ans