"use strict"
function main(arg) {
    const [N,M,X] = arg.trim().split("\n")[0].split(" ").map(Number)
    const A = arg.trim().split("\n").slice(1).map(e => e.split(" ").map(Number)).sort((a,b) => {
        return a[0] - b[0]
    })
    // console.log(JSON.stringify(A))
    let total = -1
    for (i = 1; i < 1000; i++) {
        let idx = i.toString(2).padStart(N, '0')
        if (idx.length > N) {
            break
        }
        idx = idx.split("").map(Number).reverse()
        let p = new Array(M).fill(0)
        // console.log(idx)
        let hasError = false
        let tmp = 0
        for (j = 0; j < idx.length; j++) {
            if (idx[j] === 0) {
                continue
            }
            for (k = 0; k < p.length; k++) {
                p[k] += A[j][k + 1]
                // if (k === idx.length - 1) {
                //     if (p[k] < 10) {
                //         hasError = true
                //     }
                // }
            }
            tmp += A[j][0]
        }
        p.forEach(e => {
            if (e < X) {
                hasError = true
            }
        })
        // console.log([hasError,total,p])
        if (!hasError) {
            if (total === -1) {
                total = tmp
            }
            total = Math.min(tmp, total)
        }
    }
    console.log(total)
    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));