fun main(args: Array<String>) = ABC167C.main()

object ABC167C {
    fun log(message: Any?) {
        //println(message)// TODO: ←消す
    }

    data class Book(val c: Int, val a: List<Int>)

    fun main() {
        val (N, M, X) = readInts()
        val books = (1..N).map {
            val a = readInts()
            Book(c = a.first(), a = a.drop(1))
        }

        val choices = BitChoose<Book>().generate(books)
        val best = choices
            .filter { it.isNotEmpty() }
            .filter { it.isValid(X) }
            .map { it.cost() }.min()

        val ans = best ?: -1
        println(ans)
    }

    fun List<Book>.cost(): Int = this.map { it.c }.sum()
    fun List<Book>.isValid(X: Int): Boolean {
        var a = this.first().a
        this.drop(1).forEach { book ->
            a = a.mapIndexed { index, it -> it + book.a[index] }
        }
        return a.all { it >= X }
    }

    /*####################################################################################*/
    class BitChoose<T> {
        fun generate(items: List<T>): Sequence<List<T>> {
            when {
                items.isEmpty() -> return sequenceOf(listOf())
                else -> {
                    val first = items.last()
                    val remain = items.dropLast(1)
                    val base = generate(remain)
                    return base + base.map { it + first }
                }
            }
        }
    }

    fun readString() = readLine()!!
    fun readStrings() = readLine()!!.split(" ")
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map { it.toInt() }
    fun readLong() = readLine()!!.toLong()
    fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
    fun readMatrixRows(height: Int) = (1..height).map { readLine()!!.toList() }

    fun Boolean.yesOrNo() = if (this) "Yes" else "No"
    fun Double.toNaturalExpr() = println("%f".format(this))
}