fun main(args : Array<String>) {
    val list = mutableListOf<String>()

    do {
        val line = readLine()
        if (line != null) {
            list.add(line)
        } else {
            break
        }
    } while (true)

    list.map { requireNotNull(it) }.let {
        val result= CanYouSolveThis().exec(*it.toTypedArray())
        println(result)
    }
}

class CanYouSolveThis {
    fun exec(vararg args : String) : String{
        val nmc = args[0].split(" ").let {
            Triple(it[0], it[1], it[2])
        }

        val b = args[1].split(" ")

        return (2 until args.size).map {position ->
            val a = args[position].split(" ")
            val result = a.zip(b).map {
                it.first.toInt() * it.second.toInt()
            }.sum() + nmc.third.toInt()

            result > 0
        }.count { it }.toString()
    }
}