import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

case class Book(cost: Int, skills: Array[Int])

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(n, m, x) = in.readLine().split("\\s+").map(_.toInt)
    val books = Array.fill(n) {
      val line = in.readLine().split("\\s+").map(_.toInt)
      Book(line(0), line.slice(1, line.length))
    }

    var minCost = Int.MaxValue

    for (i <- 0 until Math.pow(2, n).toInt) {
      val readBooks = books.foldLeft[(List[Book], Int)]((Nil, i)) {
        case ((acc, q), book) =>
          if ((q & 1) == 1) {
            (book :: acc, q >> 1)
          } else {
            (acc, q >> 1)
          }
      }._1
      var cost = 0
      val skill = Array.ofDim[Int](m)
      for (book <- readBooks) {
        cost += book.cost
        for (i <- skill.indices) {
          skill(i) += book.skills(i)
        }
      }
      if (skill.forall(_ >= x)) {
        minCost = Math.min(minCost, cost)
      }
    }

    out.println(
      if (minCost == Int.MaxValue) {
        -1
      } else {
        minCost
      }
    )

    out.flush()
  }
}
