let id x = x
let split_string ?(pattern=" ") = Str.split @@ Str.regexp pattern

let (n, m, x) = Scanf.sscanf (read_line ()) "%d %d %d" (fun n m x -> (n, m, x))
let ca = Array.init n (fun _ -> 
  let t = split_string @@ read_line () in
  (
    int_of_string @@ List.hd t,
    Array.of_list @@ List.map int_of_string @@ List.tl t
  )
)

let ans = ref max_int

let sum arr =
  let mm = Array.make m 0 in
  for i = 0 to n - 1 do
    if arr.(i) = 1 then
      for j = 0 to m - 1 do
        mm.(j) <- mm.(j) + (snd ca.(i)).(j)
      done
  done;
  mm

let g arr = 
  let s = ref 0 in
  for i = 0 to n - 1 do
    s := !s + (fst ca.(i)) * arr.(i)
  done;
  !s

let rec loop arr i =
  if i == n then begin
    let sum = sum arr in
    if Array.for_all (fun i -> i >= x) sum then
      ans := min !ans (g arr)
  end
  else begin
    arr.(i) <- 0; loop arr (i + 1);
    arr.(i) <- 1; loop arr (i + 1)
  end

let () =
  loop (Array.make n 0) 0;
  print_int @@ if !ans = max_int then -1 else !ans
