import java.util.Scanner
import kotlin.math.min

fun main() {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val m = scn.nextInt()
	val x = scn.nextInt()
	val b = Array(n){ Pair(scn.nextInt(), IntArray(m){scn.nextInt()}) }
	var minC = Integer.MAX_VALUE
	for (bit in 1 until (1 shl n)) {
		var cost = 0
		val sumA = IntArray(m)
		for (i in 0 until n){
			val buy = (bit and (1 shl i)) shr i
			if (buy==1){
				cost += b[i].first
				for (j in 0 until m){
					sumA[j] += b[i].second[j]
				}
			}
		}
		if (sumA.all{it>=x}) minC = min(minC, cost)
	}
	println(if (minC==Integer.MAX_VALUE) -1 else minC)
}