1. Martin Lambeck

package acm_11369_shopaholic;

import java.util.Arrays;
import java.util.Scanner;

/**
* FWP, Ausgew¦hlte Probleme aus dem ACM Programming Contest, SS10
* Problem: acm_11369_shopaholic
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&page=show_problem&problem=2354&Itemid=8
*
* @author Martin Lambeck
* @version 1.0, 17.08.2010
*
* Method : ad hoc
* Status : Accepted
* Runtime: 0.984
*/


public class Main
{
static Scanner sc = new Scanner(System.in);

public static void main(String... args)
{
int cases = sc.nextInt();

for (int i = 0; i < cases; i++)
testcase();
}

public static void testcase()
{
int l = sc.nextInt();
int[] p = new int[l];

for (int i = 0; i < l; i++)
{
p[i] = sc.nextInt();
}

Arrays.sort(p);

int i = p.length;
int disc = 0;

while (true)
{
i -= 3;

if (i < 0)
break;

disc += p[i];
}

System.out.println(disc);
}
}