#include<iostream> #include<algorithm> using namespace std; int main(){ int t,n,sum,data[20005]; scanf("%d",&t); while(t--){ scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&data[i]); } sort(data,data+n); sum = 0; for(int i=n-3;i>-1;i-=3){ sum += data[i]; } printf("%d\n",sum); } return 0; }