object Main extends App {
  import java.util.Scanner
  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  val m = sc.nextInt()
  val x = sc.nextInt()

  val ca = (1 to n).map { _ =>
    val c = sc.nextInt()
    val a = (1 to m).map { _ =>
      sc.nextInt()
    }.toVector
    (c, a)
  }

  def limit(aa: IndexedSeq[(Int, IndexedSeq[Int])]): Int = {
    var found = false
    var i = 0
    var price = 0
    val buf = ArrayBuffer.fill(m)(0)
    while (!found && i < n) {
      val aaa = aa(i)
      price = price + aaa._1
      val aaaa = aaa._2
      var j = 0
      while (j < m) {
        buf(j) = buf(j) + aaaa(j)
        j = j + 1
      }
      if (buf.forall(_ >= x)) {
        found = true
      } else {
        i = i + 1
      }
    }
    if (found) price else -1
  }
  val r = ca.permutations.map(limit).filter(_ >= 0)
  if (r.isEmpty) {
    println(-1)
  } else {
    println(r.min)
  }
}
