import kotlin.math.cos

fun main(args: Array<String>) {
  val (N, M, X) = readInts()
  val CA = (1..N).map { readInts() }

  var result = Int.MAX_VALUE
  fun dfs(depth: Int, cost: Int, array: Array<Int>) {
    val afterCost = cost + CA[depth][0]
    val afterArray = array.copyOf()
    (0 until M).forEach { afterArray[it] += CA[depth][it + 1] }

    if (depth + 1 == N) {
//      println(array.joinToString())
//      println(afterArray.joinToString())
      if (array.all { it >= X }) result = Math.min(result, cost)
      if (afterArray.all { it >= X }) result = Math.min(result, afterCost)
    } else {
      dfs(depth + 1, cost, array)
      dfs(depth + 1, afterCost, afterArray)
    }
  }
  dfs(0, 0, Array(M) { 0 })
  println(if (result == Int.MAX_VALUE) -1 else result)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }
