inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
l = inp.shift().split(" ")
N = l.shift() * 1
M = l.shift() * 1
X = l.shift() * 1

for(i=0;i<N;i++) {
    inp[i] = inp[i].split(" ").map(x => +x)
}


a = [[0], [1]]
c = []

while(a.length > 0) {
    b = a.pop()
    if (b.length == N) {
        d = 0
        e = []
        for(i=0;i<N;i++) {
            if (b[i]) {
                d += inp[i][0]
                for(j=0;j<M;j++) {
                    e[j] = (e[j] || 0) + inp[i][j+1]
                }
            }
        }
        f = 1
        for(j=0;j<M;j++) {
            if (e[j] >= X) {
                f = f && 1
            } else {
                f = f && 0
            }
        }
        if (f) {
            c.push(d)
        }
    } else {
        a.push(b.concat(0))
        a.push(b.concat(1))
    }
}
c = c.sort((a,b) => a - b)
console.log(c.length === 0 ? -1 : c[0])