object Main extends App {
  var b = readInt * 3
  var a = readLine.split(" ").map(_.toInt).sorted.reverse
  var sum = 0L
  for(i <- 1 until b if((i==2)||(i==3))) {
      sum = sum + a(i)
  }
  print(sum)
}