import kotlin.math.min

fun main() {
    val builder = StringBuilder()

    val (n, m, x) = readInputLine().split(" ").map { it.toInt() }

    val books = Array(n) {
        val input = readInputLine().split(" ").map { it.toInt() }
        Pair(input[0], input.drop(1).toIntArray())
    }

    var ans = Int.MAX_VALUE

    for (i in 0 until (1 shl n)) {
        val tmp = IntArray(m)
        var cost = 0
        for (j in 0 until n) {
            if ((i shr j) and 1 == 1) {
                cost += books[j].first
                for ((index, a) in books[j].second.withIndex()) {
                    tmp[index] += a
                }
            }
        }

        if (tmp.all { it >= x }) {
            ans = min(ans, cost)
        }
    }


    builder.appendln(if (ans == Int.MAX_VALUE) -1 else ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
