import kotlin.math.pow

fun main() {
    val iLine = readLine()!!.split(" ").map(String::toInt)
    val cList = mutableListOf<Int>()
    val aList = mutableListOf<MutableList<Int>>()
    val n = iLine[0]
    val m = iLine[1]
    val x = iLine[2]

    for(i in 1 .. n){
        val tLine = readLine()!!.split(" ").map(String::toInt)
        cList.add(tLine[0])
        aList.add(tLine.drop(1).toMutableList())
    }
    var ans = Int.MAX_VALUE
    repeat(2.0.pow(n.toDouble()).toInt()) { b ->
        var c = 0
        val sum = IntArray(m)
        for (i in 0 until n) {
            if (b and (1 shl i) == 0) continue
            c += cList[i]
            aList[i].forEachIndexed { j, a -> sum[j] += a }
        }
        if (sum.all { x <= it }) {
            ans = ans.coerceAtMost(c)
        }
    }
    println(if (ans == Int.MAX_VALUE) -1 else ans)
}