import           Control.Monad

main :: IO ()
main = do
    [n, _, c] <- fmap (map read . words) getLine :: IO [Int]
    bs        <- fmap (map read . words) getLine :: IO [Int]
    as        <- replicateM n $ fmap (map read . words) getLine :: IO [[Int]]
    print $ solve c bs as

solve :: Int -> [Int] -> [[Int]] -> Int
solve _ _  []       = 0
solve c bs (a : as) = solve c bs as + judge c bs a

judge :: Int -> [Int] -> [Int] -> Int
judge c bs as = if prod bs as + c > 0 then 1 else 0

prod :: [Int] -> [Int] -> Int
prod []       _        = 0
prod _        []       = 0
prod (b : bs) (a : as) = a * b + prod bs as
