import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N, M, X = sc.nextInt
  val CA = Array.fill(N, M + 1)(sc.nextInt)
  val C = CA.map(_.head)
  val A = CA.map(_.tail)

  val a = (0 until N).foldLeft(Set(Set.empty[Int])) {
    (set, element) => set union (set map (_ + element))
  }
  val b = a.map(_.toSeq.sorted).toSeq.filter(xs => {
    xs.map(A(_)).foldLeft(Array.fill(M)(0))((x, y) => {
      (x zip y).map { case (x, y) => x + y }
    }).forall(_ >= X)
  })
  val c = b.map(_.map(C(_)).sum)
  val x = if (c.isEmpty) -1 else c.min
  println(x)
}
