function main(input) {
  const lines = input.trim().split("\n");
  const [N, M, X] = splitN(lines.shift());

  const costs = [];
  const limit = 2 ** N;
  for (let i = 1; i < limit; i++) {
    const flags = i.toString(2).padStart(N, '0').split('').map(Number);
    const total = {cost: 0, a: []}
    flags.forEach((flg, i) => {
      if (flg) {
        const [c, ...a] = splitN(lines[i]);
        total.cost += c;
        total.a = a.map(
          (v, idx) => v + (total.a[idx] || 0)
        );
      }
    });
    if (total.a.every(v => v >= X)) {
      costs.push(total.cost);
    }
  }

  console.log(costs.length ? Math.min(...costs) : -1);
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));



function splitN(s) {
  return s.split(' ').map(Number);
}