"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const [n,m,x] = spi[0].split(' ').map(e => Number(e));

    const cArray = new Array(n), aArray = new Array(n);
    for (let i = 1; i < n + 1; i++) {
        const work = spi[i].split(' ').map(e => BigInt(e));
        cArray[i - 1] = work[0];
        const wArray = new Array(n);
        for (let j = 1; j < n + 1; j++) {
            wArray[j - 1] = work[j];;
        }
        aArray[i - 1] = wArray;
    }

    const MAX = 1000000000000000n;
    let ans = MAX;
    for (let bit = 0; bit < (1 << n); bit++) {
        let row = new Array(m);
        let sum = 0n;
        for (let i = 0; i < m; i++) row[i] = 0n;
        for (let i = 0; i < n; i++) {
            if (bit & (1 << i)) {
                for (let j = 0; j < m; j++) {
                    row[j] += aArray[i][j];
                }
                sum += cArray[i];
            }
        }

        let c = 0;
        for (let i = 0; i < m; i++) {
            if (row[i] >= x) c++;
        }

        if (c === m) {
            if (ans > sum) ans = sum;
        }
    }

    if (ans === MAX) console.log(-1);
    else console.log(ans.toString());
};

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