fun main() {
    val (n, m, x) = readLine()!!.split(" ").map(String::toInt)
    val list = Array(n) {
        readLine()!!.split(" ").map(String::toInt).toIntArray()
    }


    var min = Integer.MAX_VALUE
    for (bit in 0 until (1 shl n)) {
        val result = IntArray(m + 1)
        for(i in 0 until n){
            if(1 and (bit shr i) == 0){
                repeat(m + 1) { idx ->
                    result[idx] = result[idx] + list[i][idx]
                }
            }
        }
        if (result.drop(1).all { it >= x }) {
            min = Math.min(result[0], min)
        }
    }

    if (min == Integer.MAX_VALUE) {
        println(-1)
    } else {
        println(min)
    }
}



