let inf = 1000000000
let () =
  Scanf.scanf "%d %d %d" @@ fun n m x ->
  let books = Array.init n @@ fun i ->
    Scanf.scanf " %d" @@ fun c ->
    (c, Array.init m (fun i -> Scanf.scanf " %d" Fun.id)) in

  let ans =
    Array.init (1 lsl n) (fun i ->
      let rs = Array.init n (fun j -> ((1 lsl j) land i) > 0) in
      let ca =
        Array.init n (fun j -> if rs.(j) then fst books.(j) else 0)
        |> Array.fold_left (+) 0 in

      let ua =
        Array.init m (fun j ->
          books |> Array.mapi (fun i (c, us) -> (i, c, us))
          |> Array.fold_left (fun ua (i, _, us) ->
            if rs.(i) then ua + us.(j) else ua) 0)
        |> Array.fold_left min inf in

      let v = if ua < x then inf else ca in
      v)
    |> Array.fold_left min inf in

  Printf.printf "%d\n" (if ans = inf then -1 else ans)
