fun main(args: Array<String>) {
    
    val (n, m, c) = readLine()!!.split(" ").map { it.toInt() }
    val b = readLine()!!.split(" ").map { it.toInt() }
    val a = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }
    

  /*
    val (n, m, c) = Triple(2, 3, -10)
    val b = listOf(1, 2, 3)
    val a = listOf(
            listOf(3, 2, 1),
            listOf(1, 2, 2)
    )
    */

    val result = a.map { codes ->
        codes.foldIndexed(0, { index, acc, i -> acc + i * b[index] }) + c
    }.count { it > 0 }

    println("$result")
}
