local bit=require"bit"
N=io.read"*n"
M=io.read"*n"
X=io.read"*n"
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

local min=math.huge
for i=0,2^N-1 do
	local t={0,0,0,0,0,0,0,0,0,0,0,0}
	local c=0
	for j=0,N-1 do
		if(bit.band(bit.rshift(i,j),1)~=0)then
			for k=1,M do
				t[k]=t[k]+A[j+1][k]
			end
			c=c+C[j+1]
		end
	end
	local b=true
	for k=1,M do
		if(t[k]<X)then b=false break end
	end
	if(b)then min=math.min(min,c)end
end
print(min==math.huge and -1 or min)
