import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Prelude hiding (readLn)
import Data.Ord

main :: IO ()
main = readLn >>= flip replicateM readLn >>= print . solve . sortOn Down

solve :: [Int] -> Int
solve (x : xs) = x `div` 2 + sum xs

readLn :: IO Int
readLn = head <$> readLine

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine