fun main(args: Array<String>) {
  val (N,M,C) = readLine()!!.split(" ").map(String::toInt)
  val B = readLine()!!.split(" ").map(String::toInt)
  val A = (1..N).map{readLine()!!.split(" ").map(String::toInt)}

  val count = A.map{ a ->
    calculateAB(a, B, C, M)
  }.count{ it > 0}
  println(count)
}

fun calculateAB(a: List<Int>, B: List<Int>, C: Int, M: Int): Int {
  val ab = (0..M-1).map{i -> 
    multipleAB(a, B, i)
  }
  return ab.sum() + C
}

fun multipleAB(a: List<Int>,b: List<Int>,i: Int): Int {
  return a.get(i) * b.get(i)
}