local N, M, X = io.read("*n", "*n", "*n")

local 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 function sumList(sum_points, i)
	for j = 1, M do
		sum_points[j] = sum_points[j] + A[i][j]
	end
end

local sum_points = {}
local price = math.huge
-- N is bit length
for pattern = 1, 2^N do
	local price_sum = 0
	for i = 1, M do
		sum_points[i] = 0
	end

	for i = 1, N do
		if bit.band(pattern, 1) == 1 then
			price_sum = price_sum + C[i]
			sumList(sum_points, i)
		end
		pattern = bit.rshift(pattern, 1)
	end

	local isClear = true
	for i = 1, M do
		if X > sum_points[i] then
			isClear = false
			break
		end
	end

	if isClear and price_sum < price then
		price = price_sum
	end
end

print((price == math.huge) and -1 or price)