
let input = require("fs").readFileSync("/dev/stdin", "utf8")

function main() {
    const [N,M,X] = load(3)
    const [C,...A] = load(N,1+M)
    
    const candies = new Set()
    const max = Math.pow(2,N)//Math.pow(2,12)
    for(let i = 0; i < max; i++) {

        let sum = 0
        for(let j = 0; j < N; j++) {
            if(i & (1 << j)) {
                sum += A[0][j]
            }
        }

        if(sum >= X) candies.add(i)
    }

    for(let x = 1; x < M; x++) {
        for(const bits of candies) {

            let sum = 0
            for(let y = 0; y < N; y++) {
                if(bits & (1 << y)) {
                    sum += A[x][y]
                }
            }

            if(sum < X) candies.delete(bits)
        }
    }

    if(!candies.size) return -1

    let result = null
    for(const bits of candies) {

        let cost = 0
        for(let i = 0; i < N; i++) {
            if(bits & (1 << i)) {
                cost += C[i]
            }
        }

        if(result === null || cost < result) result = cost
    }

    return result
}

let inputs = input.split(/[\s\n]/)
console.log(main())

// 入力値を読み込む
function load(rows = 1, cols = 1, type = Number) {
    const length = rows * cols
    let result = inputs.splice(0, length)

    if(type !== String) result = result.map(type)
    if(cols > 1) {
        const arrays = new Array(cols)
        for(let col = 0; col < cols; col++) {
            arrays[col] = new Array()
            for(let row = 0; row < rows; row++) {
                arrays[col].push(result[row * cols + col])
            }
        }
        result = arrays
    }

    return result
}
