const generateCombinations = (arr, count) => {
  const res = []
  if (count === arr.length) {
    return [arr]
  }
  for (let i = 0; i<arr.length; i++) {
    // console.log(arr[i])
    const el = arr[i]
    // console.log(arr)
    const clone = arr.slice(0)
    clone.splice(i, 1)
    if (count > 1) {
      const combs = generateCombinations(clone, count - 1)
      for (const t of combs) {
        res.push([el].concat(t))
      }
    } else {
      res.push([el])
    }
  }
  // console.log(res)
  return res
}

const processData = (lines) => {
  const [n, m, x] = lines[0].split(' ').map(x => +x)
  const books = []
  const total = Array(m).fill(0)
  for (let i=0; i<n; i++) {
    const l = lines[i+1].split(' ').map(x => +x)
    // console.log(l)
    const cost = l[0]
    const skills = l.slice(1).map(skill => Math.min(skill, x))
    // console.log(skills)
    for (let j=0; j<skills.length; j++) {
      total[j] += skills[j]
    }
    // console.log('t')
    books.push({cost, skills})
  }
  const isLess = total.some(skill => skill < x)
  if (isLess) {
    console.log(-1)
  } else {
    let price = Number.MAX_SAFE_INTEGER
    for (let i=1; i<=books.length; i++) {
      const combs = generateCombinations(books, i)
      for (const arr of combs) {
        let res = Array(m).fill(0)
        let sum = 0
        for (const curBook of arr) {
          for (let b=0; b<m; b++) {
            res[b] += curBook.skills[b]
          }
          sum += curBook.cost
        }
        const existsLess = res.some(skill => skill < x)
        // console.log(existsLess, arr, res)
        if (!existsLess && price > sum) {
          price = sum
        }
      }
    }
    console.log(price)
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})
