import scala.io.StdIn._

object Main extends App {
  val Array(n, m, x) = readLine.split(" ").map(_.toInt)

  val books = Range(0, n).map { _ =>
    val line = readLine.split(" ").map(_.toInt)
    line.head -> line.tail
  }

  val patterns = Range(0, Math.pow(2, n).toInt).map { patternInt =>
    val booksToBuy = books.zipWithIndex
      .filter { case (_, idx) => ((1 << idx) & patternInt) > 0 }
      .map { case (book, _) => book }

    val initial = (0, Array.fill(m)(0).toSeq)
    booksToBuy.foldLeft(initial) {
      case ((totalCost, totalEffects), (cost, effects)) =>
        (
          totalCost + cost,
          Range(0, m).map(i => totalEffects(i) + effects(i))
        )
    }
  }

  val satisfiedWithEffects = patterns.filter { case (_, effects) => effects.forall(_ >= x) }

  if (satisfiedWithEffects.nonEmpty) {
    val (minCost, _) = satisfiedWithEffects.minBy { case (cost, _) => cost }
    println(minCost)
  } else {
    println(-1)
  }
}

