const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
const [N, M, X] = input[0].split(' ').map(Number)
const books = []

for (let i=1; i<=N; i++) {
  const [price, ...skills] = input[i].split(' ').map(Number)
  books.push({
    price,
    skills
  })
}

const solver = (n, skills) => {
  const min = skills.reduce((a, c) => Math.min(a, c))
  if (X <= min) {
    return 0
  }
  if (n == N) {
    return Infinity 
  }

  const a = solver(n+1, skills.map((v, i) => v + books[n].skills[i])) + books[n].price
  const b = solver(n+1, skills)

  return Math.min(a, b)
}

const ans = solver(0, new Array(M).fill(0))
console.log(ans !== Infinity? ans : -1)
