fun main() {
    val l = readLine()!!.split(" ").map { it.toInt() }
    val n = l[0]
    val m = l[1]
    val x = l[2]
    val array = Array(n){Array(m+1){0}}
    for(i in 0..n-1){
        val a = readLine()!!.split(" ").map { it.toInt() }
        for(j in 0..m){
            array[i][j] = a[j]
        }
    }
    var result = Int.MAX_VALUE
    fun dfs(a:Array<Int>,price:Int,count:Int){
        if(count<n) {
            val aa = a.clone()
            dfs(aa, price, count + 1)
            for (i in 0..m - 1) {
                aa[i] = a[i] + array[count][i + 1]
            }
            dfs(aa, price + array[count][0], count + 1)
        }else {
            var flag = true
            for (i in 0..m - 1) {
                val num = a[i]
                if (num < x) {
                    flag = false
                    break;
                }
            }
            if (flag) {
                if (price < result) result = price
            }
        }
    }
    dfs(Array(m){0},0,0)
    if(result == Int.MAX_VALUE){
        println("-1")
    }else{
        println(result)
    }
}