description: 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 41. It can be shown that 41 is the optimal distance for this test case.
solution: import java.lang.reflect.Array;
  import java.util.*;
  import java.io.*;
  
  //import static com.sun.tools.javac.jvm.ByteCodes.swap;
  
  
  
  
  public class fastTemp {
  
      static class Pair{
           int wt;
           int nbr;
           Pair(int wt,int nbr){
               this.wt=wt;
               this.nbr=nbr;
           }
       }
      static FastScanner ps = null;
  static long fact[] = new long[100001];
      public static void main(String[] args) {
          ps = new FastScanner();
          PrintWriter out = new PrintWriter(System.out);
          int t = ps.nextInt();
           while (t-->0) {
               int n = ps.nextInt();
               int k = ps.nextInt();
             ArrayList<Integer> al = new ArrayList<>();
             ArrayList<Integer> pl = new ArrayList<>();
             ArrayList<Integer> nl = new ArrayList<>();
             HashMap<Integer,Integer> h = new HashMap<>();
               for (int i = 0; i < n; i++) {
                   int x = ps.nextInt();
                   h.put(x,h.getOrDefault(x,1)+1);
                   if(x>0){
                       al.add(x);
                       pl.add(x);
                   }else{
                       al.add(x);
                       nl.add(x);
                   }
               }
  
  
               Collections.sort(pl);
              Collections.sort(nl,Collections.reverseOrder());
   long ans = 0 ;
              if(nl.size()>0 ){
                  int i = nl.size()-1;
                  ans += -1*nl.get(nl.size()-1);
                  i = i-k;
                  while(i>=0){
                      ans += -2*nl.get(i);
                      i -= k;
                  }
              }
              if( pl.size()>0){
                 int i = pl.size()-1;
                 ans += pl.get(i);
                 i = i-k;
                 while(i>=0){
                     ans += 2*pl.get(i);
                     i = i-k;
                 }
              }
  
              if(nl.size()>0 && pl.size()>0){
                 int x =  Math.min(Math.abs(nl.get(nl.size()-1)) , pl.get(pl.size()-1));
                  ans += x;
              }
           out.println(ans);
  
  
           }
          out.close();
      }
      public static void solve(int[] ar,int s , int e,int i){
  
  
            int ls = upper_bound(ar,i,s);
            int le = upper_bound(ar,i,e);
  
         int ids = (ls+1) - (ar[ls] - s);
         int ide  = (le+1)- ( ar[le] - e);
  
         long ld = le-ls;
         long cd = ide - ids;
       if(ld<0 || ld<cd || cd<0){
        System.out.println(0);
        }else{
  
           if(cd == 0){
               System.out.println(1);
            }else{
                long ans = 1;
                ans  =nCrModPFermat(ld,cd,1000000007);
  
                int x = 1;
                System.out.println(ans);
           }
  
  
        }
  
  
  
            }
       static long power(long x, long y, long p)
       {
  
           // Initialize result
           long res = 1;
  
           // Update x if it is more than or
           // equal to p
           x = x % p;
  
           while (y > 0) {
  
               // If y is odd, multiply x
               // with result
               if (y % 2 == 1)
                   res = (res * x) % p;
  
               // y must be even now
               y = y >> 1; // y = y/2
               x = (x * x) % p;
           }
  
           return res;
       }
  
       // Returns n^(-1) mod p
       static long modInverse(long n, long p)
       {
           return power(n, p - 2, p);
       }
  
       // Returns nCr % p using Fermat's
       // little theorem.
  
       static long nCrModPFermat(long n, long r, long p)
       {
  
           if (n<r)
               return 0;
           // Base case
           if (r == 0)
               return 1;
  
           // Fill factorial array so that we
           // can find all factorial of r, n
           // and n-r
           long[] fac = new long[(int)n + 1];
           fac[0] = 1;
  
           for (int i = 1; i <= n; i++)
               fac[i] = fac[i - 1] * i % p;
  
           return (fac[(int)n] * modInverse(fac[(int)r], p) % p * modInverse(fac[(int)n - (int)r], p) % p) % p;
       }
  
  
  //public static int dijkstra(int src , int dist[] ){
  //
  //PriorityQueue<Pair> q = new PriorityQueue<>();
  //q.add(new Pair(1,0));
  //
  //while(q.size()>0){
  //
  //    Pair rem = q.remove();
  //    for(Pair x:graph[rem.y]){
  //        if(dist[x.y]>dist[rem.y]+x.wt){
  //            dist[x.y] = dist[rem.y] + x.wt;
  //            q.add(new Pair(x.y,dist[x.y]));
  //        }
  //    }
  //
  //}
  //
  //return dist[dist.length-1];
  //
  //}
   // T --> O(n) && S--> O(d)
  
  
  
  
    static int upper_bound(int arr[], int N, int X)
       {
           int mid;
  
           // Initialise starting index and
           // ending index
           int low = 0;
           int high = N;
  
           // Till low is less than high
           while (low < high) {
               // Find the middle index
               mid = low + (high - low) / 2;
  
               // If X is greater than or equal
               // to arr[mid] then find
               // in right subarray
               if (X > arr[mid]) {
                   low = mid + 1;
               }
  
               // If X is less than arr[mid]
               // then find in left subarray
               else if(X<arr[mid]){
  
                   high = mid;
               }
               else{
                   return mid;
               }
           }
  
           // if X is greater than arr[n-1]
           if(low < N && arr[low] <= X) {
               low++;
           }
  
           // Return the upper_bound index
           return low;
       }
  
  
  
  
  
      public static class String1 implements Comparable<String1>{
          String str;
          int id;
          String1(String str , int id){
              this.str = str;
              this.id = id;
          }
          public  int compareTo(String1 o){
              int i=0;
              while(i<str.length() && str.charAt(i)==o.str.charAt(i)){
                  i++;
              }
              if(i<str.length()){
                  if(i%2==1){
                      return o.str.compareTo(str);   // descending order
                  }else{
                      return str.compareTo(o.str);  // ascending order
                  }
              }
              return str.compareTo(o.str);
          }
      }
  
  
      static void sort(int[] a) {
          ArrayList<Integer> l=new ArrayList<>();
          for (int i:a) l.add(i);
          Collections.sort(l);
          for (int i=0; i<a.length; i++) a[i]=l.get(i);
      }
      static class FastScanner {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          StringTokenizer st = new StringTokenizer("");
  
          String next() {
              while (!st.hasMoreTokens())
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          int[] readArray(int n) {
              int[] a = new int[n];
              for (int i = 0; i < n; i++) a[i] = nextInt();
              return a;
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
      }
      // ------------------------------------------swap----------------------------------------------------------------------
  
      static void swap(int arr[],int i,int j)
      {
          int temp=arr[i];
          arr[i]=arr[j];
          arr[j]=temp;
      }
  
  
      //-------------------------------------------seiveOfEratosthenes----------------------------------------------------
  
  
      static boolean prime[];
      static void sieveOfEratosthenes(int n)
      {
          // Create a boolean array
          // "prime[0..n]" and
          // initialize all entries
          // it as true. A value in
          // prime[i] will finally be
          // false if i is Not a
          // prime, else true.
          prime= new boolean[n + 1];
          for (int i = 0; i <= n; i++)
              prime[i] = true;
  
          for (int p = 2; p * p <= n; p++)
          {
              // If prime[p] is not changed, then it is a
              // prime
              if (prime[p] == true)
              {
                  // Update all multiples of p
                  for (int i = p * p; i <= n; i += p)
                      prime[i] = false;
              }
          }
  
          // Print all prime numbers
  //        for (int i = 2; i <= n; i++)
  //        {
  //            if (prime[i] == true)
  //                System.out.print(i + " ");
  //        }
      }
  
  
  
      //------------------------------------------- power------------------------------------------------------------------
  
  
  
      public static long power(int a , int b) {
          if (b == 0) {
              return 1;
          } else if (b == 1) {
              return a;
  
          } else {
  
              long R = power(a, b / 2);
              if (b % 2 != 0) {
  
  
                  return (((power(a, b / 2))) * a * ((power(a, b / 2))));
              } else {
                  return ((power(a, b / 2))) * ((power(a, b / 2)));
              }
          }
  
      }
  
  
  
      //--------------------------------------lower bound----------------------------------------------------------
  
  
      static int LowerBound(int a[], int x)
      { // x is the target value or key
          int l=-1,r=a.length;
          while(l+1<r) {
              int m=(l+r)>>>1;
              if(a[m]>=x) r=m;
              else l=m;
          }
          return r;
      }
  
      //--------------------------------------------------------------------------------------------------------------
      public static int log2(int x) {
          return (int) (Math.log(x) / Math.log(2));
      }
  
      //---------------------------------------EXTENDED EUCLID ALGO--------------------------------------------------------
    /*  public static class Pair{
          int x;
          int y;
          public Pair(int x,int y){
              this.x = x;
              this.y = y ;
          }
      }
  */
  //    public static Pair Euclid(int a,int b){
  //
  //        if(b==0){
  //            return new Pair(1,0);  // answer of x and y
  //        }
  //
  //        Pair dash = Euclid(b,a%b);
  //
  //        return new Pair(dash.y , dash.x - (a/b)*dash.y);
  //
  //
  //    }
  //--------------------------------GCD------------------GCD-----------GCD--------------------------------------------
  
      public static long gcd(long a,long b){
          if(b==0){
              return a;
          }
  
          return gcd(b,a%b);
      }
      public static void BFS(ArrayList<Integer>[] graph) {
  
  
      }
  
  // This is an extension of method 2. Instead of moving one by one, divide the array in different sets
  //where number of sets is equal to GCD of n and d and move the elements within sets.
  //If GCD is 1 as is for the above example array (n = 7 and d =2), then elements will be moved within one set only, we just start with temp = arr[0] and keep moving arr[I+d] to arr[I] and finally store temp at the right place.
  //Here is an example for n =12 and d = 3. GCD is 3 and
  
  
  //     void leftRotate(int arr[], int d, int n)
  //     {
  //         /* To handle if d >= n */
  //         d = d % n;
  //         int i, j, k, temp;
  //         int g_c_d = gcd(d, n);
  //         for (i = 0; i < g_c_d; i++) {
  //             /* move i-th values of blocks */
  //             temp = arr[i];
  //             j = i;
  //             while (true) {
  //                 k = j + d;
  //                 if (k >= n)
  //                     k = k - n;
  //                 if (k == i)
  //                     break;
  //                 arr[j] = arr[k];
  //                 j = k;
  //             }
  //             arr[j] = temp;
  //         }
  //     }
  
  
   }
  // Fenwick / BinaryIndexed  Tree  USE IT - FenwickTree ft1=new FenwickTree(n);
  