fun Int.bit(i:Int) = 1 shl i and this>0
fun <T> readList(del:String = " ",f:String.()->T) = readLine()!!.split(del).map {f(it)}

fun main() {
	val (n,m,x) = readList {toInt()}
	val a = Array(n) {readList {toInt()}.run {get(0) to drop(1)}}

	(1 until (1 shl n)).map {flag->
		var cost = 0
		val list = IntArray(m) {0}
		for((c,l) in (0 until n).asSequence().filter(flag::bit).map {a[it]}) {
			cost += c
			for(i in list.indices)
				list[i] += l[i]
		}
		if(list.all {x<=it}) cost else Int.MAX_VALUE
	}.min()!!.let {println(if(it==Int.MAX_VALUE) -1 else it)}
}
