console.log(function(args){
  const _tmp = args.trim().split('\n');
  const [N,M,X] = _tmp.shift().split(' ').map(v=>0|v);
  const book = [];
  for ( let i = 0; i < N; i++ ) {
    const [price,...A] = _tmp[i].split(' ').map(v=>0|v);
    book.push({price,A});
  }
  let skill = Array(M).fill(0), cheepest = Infinity;
  TEST: for ( let mask = 1; mask < 1 << N; mask++ ) {
    let price = 0;
    skill.fill(0);
    for ( let i = 0; i < N; i++ ) {
      if ( !(mask & 1<<i) ) continue;
      price += book[i].price;
      if ( price >= cheepest ) continue TEST;
      for ( let j = 0; j < M; j++ ) {
        skill[j] += book[i].A[j];
      }
    }
    if ( skill.some(x=>x<X) ) continue;
    cheepest = price;
  }
  return isFinite(cheepest) ? cheepest.toString() : '-1';
}(require('fs').readFileSync('/dev/stdin', 'utf8')));
