Delivery Forces
시간 제한2초메모리 제한1024 MB
3의 배수인 n명의 배달원을 세 명씩 짝지어 각 팀 중간값의 합이 최대가 되도록 나눈다.
문제
Gry finally becomes the Executive Courier Officer in "Universe Express". He has subordinate couriers with some delivery strength . The delivery strength of a team of three people is the median of their strength, i.e., the middle element after the sorting. Please help Gry to split the couriers into teams of three people in order to maximize the total delivery strength of "Universe Express". The total strength is the sum of the strength of these teams.
입력
- One line containing the number of couriers in the company, (), where is a multiple of .
- One line containing the strengths of the couriers ().
출력
The sole line of the output should contain the maximal strength of "Universe Express".