import kotlin.math.min

fun main() {
    val (n, m, x) = readLine()!!.split(" ").map { it.toInt() }
    val items = (0 until n).map {
        readLine()!!.split(" ").map { it.toInt() }
    }

    var money = -1
    fun calc(array: IntArray) {
        var price = 0
        val score = IntArray(m)
        array.forEachIndexed { index, i ->
            val item = items[index]
            item.forEachIndexed { itemIndex, itemScore ->
                if (itemIndex == 0) {
                    price += i * itemScore
                } else {
                    score[itemIndex - 1] += i * itemScore
                }
            }
        }

        if (!score.any { it < x }) {
            money = if (money == -1) {
                price
            } else {
                min(money, price)
            }
        }
    }

    val arrayList = mutableListOf<IntArray>()
    fun createArray(array: IntArray, position: Int = 0) {
        if (position >= n) return
        val array1 = array.clone()
        val array2 = array.clone()
        array2[position] = 1
        arrayList.add(array1)
        arrayList.add(array2)

        createArray(array1, position + 1)
        createArray(array2, position + 1)
    }

    createArray(IntArray(n))
    arrayList.forEach { calc(it) }
    println(money)
}