function C167(_input) {
    var lines = _input.split("\n");
    var first = lines.shift().split(' ').map(v => v*1);
    var sankonum = first[0];
    var algoNum = first[1];
    var score = first[2];
    // var power = Array(algoNum).fill(0);
    var price = 0;

    var cost = []; // c0 = 0番目のコスト
    var power = []; // p00 = 本0の0の理解度、p01 = 本0の1の理解度

    for (var i = 0; i < sankonum; i++) {
        var item = lines.shift().split(' ').map(v => v*1);

        cost[i] = item.shift();
        power[i] = item;
    }

    var answer = 100000000000;
    for (var i = 0; i < (1<<sankonum); i++) {
        // 0, 1, 0, 0, 0, 1のようなパターン
        var price = 0;
        var d = Array(algoNum).fill(0);
        for (var j = 0; j < sankonum; j++) {
            if (i>>j&1 === 1) {
                price += cost[j];

                for (var k = 0; k < algoNum; k++) {
                    d[k] += power[j][k];
                }
            }
        }
        var test = d.some((v) => v < score);
        if (!test) {
            answer = Math.min(answer, price);
        }
    }

    if (answer === 100000000000) {
        console.log(-1);
        return;
    }

    console.log(answer);
}
C167(require("fs").readFileSync("/dev/stdin", "utf8"));
