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

case class Book(cost: Int, as: 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))
    }

    def dfs(cost: Int, skills: Array[Int], books: Array[Book]): Int = {
      if (skills.forall(_ >= x)) {
        cost
      } else if (books.isEmpty) {
        -1
      } else {
        var minCost = Int.MaxValue
        for (i <- books.indices) {
          val book = books(i)
          val newCost = cost + book.cost
          val newSkills = skills.zip(book.as).map {
            case (a, b) => a + b
          }
          minCost = Math.min(minCost, dfs(newCost, newSkills, books.slice(0, i).concat(books.slice(i + 1, books.length))))
        }
        minCost
      }
    }

    out.println(
      dfs(0, Array.ofDim[Int](m), books)
    )

    out.flush()
  }
}
