import Control.Monad

main = do
    fst <- getLine
    let [n, m, c] = map read (words fst)
    snd <- getLine
    let bs = map read (words snd) :: [Int]
    thd <- replicateM n getLine
    let as = map (map read) (map words thd) :: [[Int]]
    let y = ans as bs c
    print y

hantei :: [Int] -> [Int] -> Int -> Int
hantei a bs c = (sum $ zipWith (*) a bs) + c

ans :: [[Int]] -> [Int] -> Int -> Int
ans (a:[]) bs c
    | hantei a bs c > 0 = 1
    | otherwise = 0
ans (a:as) bs c
    | hantei a bs c > 0 = (ans as bs c) + 1
    | otherwise = ans as bs c
