let rec list_sum res = function | [] -> res | l::ls -> list_sum (l+res) ls

let _ =
  let n, m, c = Scanf.scanf "%d %d %d\n" (fun n m c -> (n, m, c)) in
  let res = Array.make n 0 in
  let bs = Array.make m 0 in
  for i=0 to m-1 do
    Scanf.scanf (if i=(m-1) then "%d\n" else "%d ") (fun b -> bs.(i) <- b)
  done;
  for i=0 to n-1 do
    let temp = ref 0 in
    for j=0 to m-1 do
      Scanf.scanf (if j=(m-1) then "%d\n" else "%d ") 
        (fun a -> temp := !temp + a * bs.(j))
    done;
    res.(i) <- if !temp + c > 0 then 1 else 0
  done;
  list_sum 0 (Array.to_list res) |> print_int