import Control.Applicative import Control.Monad import System.IO main :: IO () main = do t_temp <- getLine let t = read t_temp :: Int forM_ [1..t] $ \a0 -> do n_temp <- getLine let n = read n_temp :: Int a_temp <- getLine let a = map read $ words a_temp :: [Int] putStrLn . show . f $ a getMultipleLines :: Int -> IO [String] getMultipleLines n | n <= 0 = return [] | otherwise = do x <- getLine xs <- getMultipleLines (n-1) let ret = (x:xs) return ret f = (==0) . (flip mod 3) . sum . map (read . (\x -> [x])) . concat . map show