'use strict'

const Main = (input) => {
  const tmp = input.trim().split('\n')
  const N = parseInt(tmp[0].split(' ')[0])
  const M = parseInt(tmp[0].split(' ')[1])
  const X = parseInt(tmp[0].split(' ')[2])

  const bookArr = []

  for (let j = 1; j <= N; j++) {
    bookArr.push(tmp[j].split(' ').map(Number))
  }

  const n = N
  const priceArr = []

  for (let bit = 0; bit < (1 << n); bit++) {
    let row = []
    for (let i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        row.push(i)
      }
    }
    const skillArr = new Array(M + 1).fill(0)

    row.forEach(elem => {
      for (let k = 0; k <= M; k++) {
        skillArr[k] += bookArr[elem][k]
      }
    })
    const isEnough = skillArr.every(n => n >= X)
    if (isEnough) {
      priceArr.push(skillArr[0])
    }
  }

  let result = -1
  if (priceArr.length != 0) {
    result = priceArr.sort()[0]
  }
  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))