import Data.Bool

main :: IO ()
main = do
  { [n,m,c] <- readLineInputs
  ; bs <- readLineInputs
  ; ass <- loop n
  ; print $ solve ass bs c
  }

loop :: Int -> IO [[Int]]
loop 0 = return []
loop n = do
  { xs  <- readLineInputs
  ; xss <- loop (pred n)
  ; return (xs:xss)
  }

{- |
>>> let [n,m,c] = map read (words "2 3 -10") :: [Int]
>>> let bs = map read (words "1 2 3") :: [Int]
>>> let ass = map (map read . words) (lines "3 2 1\n1 2 2")
>>> solve ass bs c
1
-}
solve :: [[Int]] -> [Int] -> Int -> Int
solve xss ys z = iter xss ys z 0
  where
    iter []       _  _ n = n
    iter (as:ass) bs c n = iter ass bs c $ bool n (succ n) (prod as bs + c > 0)

readLineInputs :: Read a => IO [a]
readLineInputs = map read . words <$> getLine

prod :: [Int] -> [Int] -> Int
prod = (sum .) . zipWith (*) 
