"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

function main() {
    let N = +cin.shift();
    let M = +cin.shift();
    let X = +cin.shift();
    let C = [];
    for (let i = 0; i < N; i++) {
        let kakaku = +cin.shift();
        let A = [];
        for (let j = 0; j < M; j++) {
            A[j] = +cin.shift();
        }
        C.push({ kakaku: kakaku, A: A });
    }
    C = C.sort((x, y) => x.kakaku - y.kakaku);
    let all_comb = 2 ** C.length;
    let ans = -1;
    //console.log(C);
    for (let i = 1; i <= all_comb; i++) {
        let temp = (('000000000000000') + i.toString(2)).slice(-N).split("");
        //console.log(temp);
        let nedan = 0;
        let noryoku = Array(M).fill(0);
        for (let j = 0; j < temp.length; j++) {
            if (temp[j] == '1') {
                //console.log(C[j]);
                nedan += C[j].kakaku;
                for (let k = 0; k < M; k++) {
                    noryoku[k] += C[j].A[k];
                }
            }
        }
        //console.log({ noryoku })
        // すべての能力がX以上かつansよりnedanが小さい場合
        if (noryoku.every(v => v >= X) && (ans == -1 || nedan < ans)) {
            ans = nedan;
        }
    }
    console.log(ans);

}
main();
