#include<iostream> #include<algorithm> #include<cstdio> using namespace std; bool cmp(int a,int b){ return a>b; } int main(){ int t,n,a[20005]; scanf("%d",&t); while(t--){ scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n,cmp); // for(int i=0;i<n;i++) // cout<<a[i]<<endl; int sum = 0; for(int i=2;i<n;i+=3) sum += a[i]; printf("%d\n",sum); } return 0; }