import kotlin.math.min

fun main() {

    val (n,m,x) = readLine()!!.split(" ").map { it.toInt() }
    val subject = Array(n){IntArray(m+1) }

    for(i in 0 until n) {
        subject[i] = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    }

    fun dfs(idx:Int, learn:IntArray, cost:Int): Int {
        var isOk = true
        var ans = Int.MAX_VALUE

        for(i in 1..m) {
            if(learn[i] < x) {
                isOk = false
                break
            }
        }

        if(isOk) {
            return cost
        }

        for(select in idx until n) {
            for(j in 1..m) {
                learn[j] += subject[select][j]
            }
            ans = min(ans, dfs(select + 1, learn, cost + subject[select][0]))
            for(j in 1..m) {
                learn[j] -= subject[select][j]
            }
        }
        return ans
    }

    var ans = dfs(0, IntArray(m+1), 0)
    if(ans == Int.MAX_VALUE) {
        ans = -1
    }
    print(ans)





}