// ABC167 - B
function main(input) {
  var inputs = input.split('\n');
  var line1 = inputs[0].split(' ');
  var n = parseInt(line1[0], 10);
  var m = parseInt(line1[1], 10);
  var x = parseInt(line1[2], 10);

  var c = [];
  var a = [];
  for (var i = 0; i < n; i++) {
    var lineN = inputs[i + 1].split(' ');
    c.push(parseInt(lineN[0], 10));
    a[i] = [];
    for (var j = 1; j < m + 1; j++) {
      a[i].push(parseInt(lineN[j], 10));
    }
  }

  var iniAs = [];
  for (var i = 0; i < m; i++) {
    iniAs.push(0);
  }

  var maxCost = c.reduce((a, b) => a + b);
  var minCost = maxCost * 1;

  var bits = bitComb(n);
  bits.forEach((bit) => {
    var tempCost = 0;
    var tempAs = iniAs;
    bit.forEach((bitItem) => {
      tempCost += c[bitItem];
      tempAs = sumItems(tempAs, a[bitItem]);
    });
    if (tempAs.every((foo) => foo >= x)) minCost = Math.min(minCost, tempCost);
  });

  console.log(minCost != maxCost ? minCost : -1);
}

function bitComb(n) {
  var ret = [];
  for (let bit = 0; bit < (1 << n); bit++) {
    let row = [];
    for (let i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        row.push(i);
      }
    }
    ret.push(row);
  }
  return ret;
}

function sumItems(arr1, arr2) {
  var ret = [];
  for (var i = 0; i < arr1.length; i++) {
    ret.push(arr1[i] + arr2[i]);
  }
  return ret;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
