#agc012a. [agc012_a]AtCoder Group Contest

[agc012_a]AtCoder Group Contest

Problem Statement

There are 3N3N participants in AtCoder Group Contest. The strength of the ii-th participant is represented by an integer aia_i. They will form NN teams, each consisting of three participants. No participant may belong to multiple teams.

The strength of a team is defined as the second largest strength among its members. For example, a team of participants of strength 11, 55, 22 has a strength 22, and a team of three participants of strength 33, 22, 33 has a strength 33.

Find the maximum possible sum of the strengths of NN teams.

Constraints

  • 1N1051 ≤ N ≤ 10^5
  • 1ai1091 ≤ a_i ≤ 10^{9}
  • aia_i are integers.

Input

Input is given from Standard Input in the following format:

NN a1a_1 a2a_2 ...... a3Na_{3N}

Output

Print the answer.


Sample Input 1

2
5 2 8 5 1 5

Sample Output 1

10

The following is one formation of teams that maximizes the sum of the strengths of teams:

  • Team 11: consists of the first, fourth and fifth participants.
  • Team 22: consists of the second, third and sixth participants.

Sample Input 2

10
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

Sample Output 2

10000000000

The sum of the strengths can be quite large.