bit=require("bit")
n,m,x=io.read("*n","*n","*n","*l")
c={}
a={}
for i=1,n do
    c[i]=io.read("*n")
    a[i]={}
    for j=1,m do
        a[i][j]=io.read("*n")
    end
end

total=-1
for i=0,bit.lshift(1,n)-1 do
    icopy=i
    price=0
    xable={}
    for j=1,m do
        xable[j]=0
    end
    for j=1,n do
        if icopy%2==1 then
            for k=1,m do
                xable[k]=xable[k]+a[j][k]
            end
            price=price+c[j]
        end
        icopy=bit.rshift(icopy,1)
    end
    xbove=true
    for j=1,m do
        if xable[j]<x then
            xbove=false
        end
    end
    if xbove then
        if total==-1 then
            total=price
        else
            total=math.min(total,price)
        end
    end
end
print(total)
