import java.util.*
import java.math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private const val MOD = 1_000_000_007L


fun solveC(N:Int, M:Int, X:Int, C:Array<Int>, A:Array<Array<Int>>): Int {
    var res = Int.MAX_VALUE

    for(p in 0 until (0b01 shl N)) {
        var ptn = p
        var sk = Array<Int>(M){0}
        var cost = 0

        for (i in 0 until N) {
            if ((ptn and 0b01) == 1) {
                A[i].forEachIndexed{ j, v -> sk[j] += v }

                cost += C[i]
            }
            ptn = ptn shr 1
        }

        if (sk.count{it < X} == 0) {
            res = Math.min(res, cost)
        }
    }

    return if (res == Int.MAX_VALUE) -1 else res
}


fun main(args: Array<String>) {
    val (N,M,X) = readListInt()
    val C = Array<Int>(N){0}
    val A = Array(N){Array<Int>(M){0} }
    for(i in 0 until N) {
        val ca = readListInt()
        C[i] = ca[0]
        ca.drop(1).forEachIndexed{j,v -> A[i][j] = v}
    }

    val ans = solveC(N, M, X, C, A)

    println(ans)
}
