import java.util.Scanner

import scala.collection.mutable.ArrayBuffer
import scala.util.control.Breaks
import scala.math.abs

object Main extends App {

  val sc = new Scanner(System.in)
  val n, m, x = sc.nextInt()
  sc.nextLine()


  val book = (1 to n).map { _ =>
    sc.nextLine().split(" ").map(_.toInt)
  }


  val ps = powerSet(book.toList)

  val res = ps.map(read).filter(_ >= 0).minOption match {
    case Some(value) => println(value)
    case None => println(-1)
  }

  def read(books: List[Array[Int]]): Int = {
    var price = 0
    val status = ArrayBuffer.fill(m)(0)
    books.foreach { book =>
      price += book(0)
      (1 to m).foreach { i =>
        status(i - 1) += book(i)
      }
    }
    if (status.forall(_ >= x)) price else -1
  }

  def powerSet[A](xs: List[A]): List[List[A]] =
    xs.foldLeft(List(Nil: List[A]))((accum, elem) => accum.flatMap(l => Seq(l, elem :: l)))
}
