fun main(args: Array<String>) {
    abc121b()
}

fun abc121b() {
    val (n, m, c) = readLine()!!.split(" ").map { it.toInt() }
    val bList = readLine()!!.split(" ").map { it.toInt() }
    val aList = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }

    val answer = aList.map {
        it.mapIndexed { index, i -> i * bList[index] }.sum() + c
    }.count { it > 0 }

    println(answer)
}
