parseLs :: IO [Int]
parseLs = (fmap read . words) <$> getLine

main = do
    [n,m,c] <- parseLs
    bs <- parseLs
    rs <- sequence $ replicate n (solve c bs)
    print $ length $ filter (>0) rs

solve :: Int -> [Int] -> IO Int
solve c bs = do
    xs <- parseLs
    return $ calc c bs xs

calc :: Int -> [Int] -> [Int] -> Int
calc c bs xs = foldl (+) c $ zipWith (*) bs xs