fun main(args: Array<String>) {
    val (n, m, c) = readLine()?.split(" ")?.map(String::toInt) ?: return
    val b = readLine()?.split(" ")?.map(String::toInt) ?: return
    0.until(n).count {
        val a = readLine()?.split(" ")?.map(String::toInt) ?: return
        a.foldIndexed(0, { i, t, aa ->
            t + (aa * b[i])
        }) + c > 0
    }.let {
        println(it.toString())
    }
}