let [|N;M;X|] =
    stdin.ReadLine().Split()
    |> Array.map int
let CA =
    [|1..N|]
    |> Array.map (fun _ ->
        stdin.ReadLine().Split()
        |> Array.map int)
let INF = 10000000

[0..int(2.0**float(N)-1.0)]
|> List.fold (fun min item ->
    Array.fold (fun (state,bit) ca ->
        if bit&&&1 = 1 then
            let s =
                Array.zip state ca
                |> Array.map (fun (sum,item) -> sum+item)
            (s, bit>>>1)
        else (state, bit>>>1)) ((Array.create (M+1) 0),item) CA
    |> fun (state,_) -> state
    |> fun ca ->
        let c = ca.[0]
        let a = ca.[1..]
        if c < min then
            let ok = Array.fold (fun state item -> state && (item>=X)) true a
            if ok then c
            else min
        else min) INF
|> function
    | x when x=INF -> -1
    | x -> x
|> stdout.WriteLine