fun main(args: Array<String>) {
    val (n,m,c) = readLine()!!.split(" ").map { it.toInt() }
    val b = readLine()!!.split(" ").map { it.toInt() }
    println((0 until n).filter {
        readLine()!!.split(" ")
            .mapIndexed{it,s->b[it]*s.toInt()}
            .sum()+c>0
    }.size)
}