function main(input) {
  let [n,m,x] = input[0].trim().split(" ").map(i => parseInt(i));

  let a = [];
  let c = [];

  for(let i=0;i<n;i++){
    a[i] = input[i+1].trim().split(" ").map(i => parseInt(i));
    c[i] = a[i].shift();
  }

  let pattern = [];

  function getPattern(pat,position){
    if(position===0){
      pattern.push(pat)
    }else{
      let a = [...pat];
      let b = [...pat];
      a.push(0);
      b.push(1);
      getPattern(a,position-1);
      getPattern(b,position-1);
    }
  }
  getPattern([],n)

  let min = (10**5) * 13;
  for(let i of pattern){
    let sum = [];
    let c_sum = 0;
    for(let j=0;j<m;j++){
      sum[j]=0;
    }
    for(let j in i){
      if(i[j]===1){
        for(let k=0;k<m;k++){
          sum[k]+=a[j][k];
        }
        c_sum+=c[j];
      }
    }
    let judge=true;
    for(let j in sum){
      if(sum[j]<x){
        judge=false;
        break;
      }
    }
    if(judge && (min>c_sum)){
      min = c_sum;
    }
  }

  console.log((min===((10**5)*13))?-1:min);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));