import kotlin.math.min

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun enumerateCombination(n: Int, k: Int): List<List<Int>> {
    if (k == 0) return listOf(listOf())

    val result = mutableListOf<List<Int>>()
    for (i in 0 until n) {
        if (n - i - 1 < k - 1) continue
        enumerateCombination(n - i - 1, k - 1).forEach {
            result.add(listOf(i) + it.map { j -> j + i + 1 })
        }
    }

    return result
}

fun main() {
    val (n, m, x) = readIntList()
    val a = mutableListOf<List<Int>>()
    val c = mutableListOf<Int>()
    for (k in 0 until n) {
        val ca = readIntList()
        c.add(ca[0])
        a.add(ca.subList(1, ca.size))
    }

    var result = Int.MAX_VALUE
    (1..n).forEach { k ->
        enumerateCombination(n, k).forEach { comb ->
            val comprehension = Array(m) { 0 }
            var price = 0
            comb.forEach {
                a[it].forEachIndexed { index, value -> comprehension[index] += value }
                price += c[it]
            }
            if (comprehension.all { it >= x }) {
                result = min(result, price)
            }
        }
    }

    if (result == Int.MAX_VALUE) {
        println(-1)
    } else {
        println(result)
    }
}