open Batteries

let sum a b c =
  let p = List.combine a b in
  let rec aux acc = function
    | [] -> acc + c
    | (a1, b1) :: rest -> aux (acc + (a1 * b1)) rest
  in
  aux 0 p

let () =
  let n, _, c =
    Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c -> (a, b, c))
  in
  let b = read_line () |> String.split_on_char ' ' |> List.map int_of_string in
  let ans = ref 0 in
  for i = 0 to n - 1 do
    let a =
      read_line () |> String.split_on_char ' ' |> List.map int_of_string
    in
    if sum a b c > 0 then ans := !ans + 1 else ()
  done;
  print_int !ans;
  print_newline ()
