import java.lang.Integer.min
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val m = sc.nextInt()
    val x = sc.nextInt()
    val c = mutableListOf<Int>()
    val a = Array(n) {mutableListOf<Int>()}
    repeat(n) {i->
        c.add(sc.nextInt())
        repeat(m) {
            a[i].add(sc.nextInt())
        }
    }

    var ans = Int.MAX_VALUE
    for (i in 1 until (1 shl n)) {
        val sum = Array(m) {0}
        var cost = 0
        for (j in 0 until n) {
            if (i and (1 shl j) == 0) continue
            cost += c[j]
            for (k in 0 until m) {
                sum[k] += a[j][k]
            }
        }
        val count = sum.count { it >= x }
        if (count == m) {
            ans = min(cost, ans)
        }
    }
    println(if (ans == Int.MAX_VALUE) -1 else ans)
}