import java.util.Scanner

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val n, m, x = sc.nextInt()

    val bits = bitSearch(n, Vector(true, false))

    val cs = Vector.fill(n)(Vector.fill(m + 1)(sc.nextInt()))

    val ans =
      bits
        .map { bit =>
          val ar = new Array[Int](m + 1)
          cs.zip(bit).foreach {
            case (vec, b) =>
              if (b) {
                (0 to m).foreach { i =>
                  ar(i) += vec(i)
                }
              }
          }

          if (ar.tail.forall(_ >= x)) ar.headOption
          else None
        }
        .filter(_.isDefined)

    val ansStr = if (ans.isEmpty) -1 else ans.min.get

    println(ansStr)
  }

  def f(n: Int): Int = {
    if (n < 0) n + 360
    else if (n > 360) n % 360
    else n
  }

  //region

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }

  def printExecTime(process: => Unit): Unit = {
    val start = System.currentTimeMillis
    process
    debug("処理時間： " + (System.currentTimeMillis - start) + " ミリ秒")
  }

  def bitSearch[T](n: Int, choice: Vector[T]): Vector[Vector[T]] = {
    @tailrec
    def bitSearchLogic(n: Int,
                       choice: Vector[T],
                       acc: Vector[Vector[T]]): Vector[Vector[T]] = {
      if (n == 0) acc
      else {
        val newAcc =
          acc.flatMap(vec => {
            choice.map(c => vec :+ c)
          })
        bitSearchLogic(n - 1, choice, newAcc)
      }
    }

    val firstAcc = choice.map(i => Vector(i))
    bitSearchLogic(n - 1, choice, firstAcc)
  }
  //endregion
}
