import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readContents 2 >>= main'
    where
        main' [[n, m, c], bs] = readContents n >>= print . solve c bs

solve :: Int -> [Int] -> [[Int]] -> Int
solve c bs = length . filter (> 0) . map mf
    where
        mf = (+ c) . sum . zipWith (*) bs

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