{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eThe coach of Nha Trang University, Mr. Van, has just\n organized a contest to form its ICPC teams. There were students\n participating in the contest. The \u003cspan class\u003d\"tex2jax_process\"\u003e$i^\\textrm {th}$\u003c/span\u003e student scored\n \u003cspan class\u003d\"tex2jax_process\"\u003e$P_ i$\u003c/span\u003e in the contest.\u003c/p\u003e\n \u003cp\u003eThe coach wants to form \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e different teams (each team has\n \u003cspan class\u003d\"tex2jax_process\"\u003e$3$\u003c/span\u003e students) to take part\n in the regional contest based on the results from this contest.\n In his experience, the performance of a team is usually equal\n to the median of team members’ individual results (i.e. the\n result of the second-best student).\u003c/p\u003e\n \u003cp\u003eThe coach wants to maximize \u003cspan class\u003d\"tex2jax_process\"\u003e$S$\u003c/span\u003e – the sum of his \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e teams’ performance. Your task is\n to calculate \u003cspan class\u003d\"tex2jax_process\"\u003e$S$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe input consists of several datasets. The first line of\n the input contains the number of datasets which is a positive\n integer and is not greater than \u003cspan class\u003d\"tex2jax_process\"\u003e$20$\u003c/span\u003e. The following lines describe the\n datasets.\u003c/p\u003e\n \u003cp\u003eEach dataset is described by the following lines:\u003c/p\u003e\n \u003cul class\u003d\"itemize\"\u003e\n \u003cli\u003e\n \u003cp\u003eThe first line contains a positive integer \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e \u003cspan class\u003d\"tex2jax_process\"\u003e$(N \\le 100)$\u003c/span\u003e.\u003c/p\u003e\n \u003c/li\u003e\n \u003cli\u003e\n \u003cp\u003eThe second line contains \u003cspan class\u003d\"tex2jax_process\"\u003e$3N$\u003c/span\u003e positive integers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$P_1, P_2, \\ldots ,\n P_{3N}$\u003c/span\u003e \u003cspan class\u003d\"tex2jax_process\"\u003e$(P_ i \\le\n 100)$\u003c/span\u003e.\u003c/p\u003e\n \u003c/li\u003e\n \u003c/ul\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eFor each dataset, output the value \u003cspan class\u003d\"tex2jax_process\"\u003e$S$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eExplanation for the Sample Dataset\u003c/h2\u003e\n \u003cp\u003eOne way to form two teams is:\u003c/p\u003e\n \u003cul class\u003d\"itemize\"\u003e\n \u003cli\u003e\n \u003cp\u003eTeam \u003cspan class\u003d\"tex2jax_process\"\u003e$1$\u003c/span\u003e: student\n \u003cspan class\u003d\"tex2jax_process\"\u003e$1$\u003c/span\u003e, student\n \u003cspan class\u003d\"tex2jax_process\"\u003e$2$\u003c/span\u003e, student\n \u003cspan class\u003d\"tex2jax_process\"\u003e$3$\u003c/span\u003e;\u003c/p\u003e\n \u003c/li\u003e\n \u003cli\u003e\n \u003cp\u003eTeam \u003cspan class\u003d\"tex2jax_process\"\u003e$2$\u003c/span\u003e: student\n \u003cspan class\u003d\"tex2jax_process\"\u003e$4$\u003c/span\u003e, student\n \u003cspan class\u003d\"tex2jax_process\"\u003e$5$\u003c/span\u003e, student\n \u003cspan class\u003d\"tex2jax_process\"\u003e$6$\u003c/span\u003e.\u003c/p\u003e\n \u003c/li\u003e\n \u003c/ul\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\n2\n8 8 6 9 10 9\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e17\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}