import java.util.*

fun main() {
    val sc = Scanner(System.`in`)

    val n = sc.nextInt()
    val m = sc.nextInt()
    val x = sc.nextInt()

    data class Book(val c: Int, val a: IntArray)

    val books = Array(n) { Book(sc.nextInt(), IntArray(m) { sc.nextInt() }) }

    val ricakido = IntArray(m)
    var min = Int.MAX_VALUE;
    fun calc(list: List<Book>) {
        //println(list)
        ricakido.fill(0)
        var sum = 0
        for (book in list) {
            sum += book.c
            for (i in book.a.indices) {
                ricakido[i] += book.a[i]
            }
        }
        if (ricakido.all { it >= x })
            min = minOf(min, sum)
    }

    fun dp(list: MutableList<Book>, i: Int) {
        if (i != -1) 
            list.add(books[i])
        calc(list)
        for (j in i + 1 until n) {
            dp(list, j)
        }
        if (i != -1) 
            list.removeAt(list.lastIndex)
    }

    dp(mutableListOf(), -1)
    
    if (Int.MAX_VALUE == min)
        println("-1")
    else 
        println(min)
}
