open System

let n, m, x, a, c =
    let n, m, x =
        let l = Console.ReadLine().Split(' ') |> Array.map int
        l.[0], l.[1], l.[2]

    let a, c =
        let ls =
            [ for i in 0 .. n - 1 do
                yield Console.ReadLine().Split(' ') |> Array.map int ]

        let a = Array2D.init n m (fun i j -> ls.[i].[j + 1])
        let c = Array.init n (fun i -> ls.[i].[0])
        a, c

    n, m, x, a, c

let ans =
    let rec dfs is k =
        if k = n then
            let ok =
                [ for j in 0 .. m - 1 ->
                    [ for i in is -> a.[i, j] ] ]
                |> List.map (fun l -> l |> List.sum)
                |> List.forall (fun sum -> sum >= x)

            if ok then
                is
                |> List.map (fun i -> c.[i])
                |> List.sum
            else
                -1
        else
            let a, b = dfs is (k + 1), dfs (k :: is) (k + 1)
            match a, b with
            | a, -1 -> a
            | -1, b -> b
            | _ -> min a b
    dfs [] 0

ans |> Console.WriteLine
