{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eA \u003cspan class\u003d\"tex-font-style-it\"\u003emedian\u003c/span\u003e of an array of integers of length $$$n$$$ is the number standing on the $$$\\lceil {\\frac{n}{2}} \\rceil$$$ (rounding up) position in the non-decreasing ordering of its elements. Positions are numbered starting with $$$1$$$. For example, a median of the array $$$[2, 6, 4, 1, 3, 5]$$$ is equal to $$$3$$$. \u003cspan class\u003d\"tex-font-style-bf\"\u003eThere exist some other definitions of the median, but in this problem, we will use the described one.\u003c/span\u003e\u003c/p\u003e\u003cp\u003eGiven two integers $$$n$$$ and $$$k$$$ and \u003cspan class\u003d\"tex-font-style-bf\"\u003enon-decreasing\u003c/span\u003e array of $$$nk$$$ integers. Divide all numbers into $$$k$$$ arrays of size $$$n$$$, such that each number belongs to \u003cspan class\u003d\"tex-font-style-bf\"\u003eexactly\u003c/span\u003e one array.\u003c/p\u003e\u003cp\u003eYou want the sum of medians of all $$$k$$$ arrays to be the maximum possible. Find this maximum possible sum.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 100$$$)\u0026nbsp;— the number of test cases. The next $$$2t$$$ lines contain descriptions of test cases.\u003c/p\u003e\u003cp\u003eThe first line of the description of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \\leq n, k \\leq 1000$$$).\u003c/p\u003e\u003cp\u003eThe second line of the description of each test case contains $$$nk$$$ integers $$$a_1, a_2, \\ldots, a_{nk}$$$ ($$$0 \\leq a_i \\leq 10^9$$$)\u0026nbsp;— given array. It is guaranteed that the array is non-decreasing: $$$a_1 \\leq a_2 \\leq \\ldots \\leq a_{nk}$$$.\u003c/p\u003e\u003cp\u003eIt is guaranteed that the sum of $$$nk$$$ for all test cases does not exceed $$$2 \\cdot 10^5$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case print a single integer\u0026nbsp;— the maximum possible sum of medians of all $$$k$$$ arrays.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e6\n2 4\n0 24 34 58 62 64 69 78\n2 2\n27 61 81 91\n4 3\n2 4 16 18 21 27 36 53 82 91 92 95\n3 4\n3 11 12 22 33 35 38 67 69 71 94 99\n2 1\n11 41\n3 3\n1 1 1 1 1 1 1 1 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e165\n108\n145\n234\n11\n3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe examples of possible divisions into arrays for all test cases of the first test:\u003c/p\u003e\u003cp\u003eTest case $$$1$$$: $$$[0, 24], [34, 58], [62, 64], [69, 78]$$$. The medians are $$$0, 34, 62, 69$$$. Their sum is $$$165$$$.\u003c/p\u003e\u003cp\u003eTest case $$$2$$$: $$$[27, 61], [81, 91]$$$. The medians are $$$27, 81$$$. Their sum is $$$108$$$.\u003c/p\u003e\u003cp\u003eTest case $$$3$$$: $$$[2, 91, 92, 95], [4, 36, 53, 82], [16, 18, 21, 27]$$$. The medians are $$$91, 36, 18$$$. Their sum is $$$145$$$.\u003c/p\u003e\u003cp\u003eTest case $$$4$$$: $$$[3, 33, 35], [11, 94, 99], [12, 38, 67], [22, 69, 71]$$$. The medians are $$$33, 94, 38, 69$$$. Their sum is $$$234$$$.\u003c/p\u003e\u003cp\u003eTest case $$$5$$$: $$$[11, 41]$$$. The median is $$$11$$$. The sum of the only median is $$$11$$$.\u003c/p\u003e\u003cp\u003eTest case $$$6$$$: $$$[1, 1, 1], [1, 1, 1], [1, 1, 1]$$$. The medians are $$$1, 1, 1$$$. Their sum is $$$3$$$.\u003c/p\u003e"}}]}