"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n)).sort((a,b)=>b-a);
    
    let teams = [];
    
    for(let i=0; i<N; i++) {
        teams.push([]);
    }
    
    let answer = 0;
    
    for(let i=0; i<3*N; i++) {
        const mod = i % N;
        
        teams[mod].push(A[i]);
    }
    
    for(let i=0; i<N; i++) {
        answer += teams[i][1];
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));