import Control.Monad

main = do
    [n, m, c] <- map read <$> words <$> getLine
    b <- map read <$> words <$> getLine
    a <- forM [1..n] $ \i -> do
        map read <$> words <$> getLine
    putStrLn $ show $ solve n m c a b

solve :: Int -> Int -> Int -> [[Int]] -> [Int] -> Int
solve n m c a b = length $ filter ((> 0) . prog) a
  where
    prog a = (sum $ map (uncurry (*)) $ zip a b) + c