String(0b111 >> 1, radix: 2)

func main() {
    let NMX = readLine()!.split(separator: " ").map {Int($0)!}
    let (N, M, X) = (NMX[0], NMX[1], NMX[2])
    var ithBook = [[Int]]()
    for _ in 0..<N {
        ithBook.append(readLine()!.split(separator: " ").map {Int($0)!})
    }
    let possibility = 1 << N
    var lowestCost = Int.max
    for i in 0..<possibility {
        var cost = 0
        var understangs = [Int](repeating: 0, count: M)
        for j in 0..<N {
            if ((i >> j) & 1) == 1 {
                cost += ithBook[j-1][0]
                for k in 0..<M {
                    understangs[k] += ithBook[j-1][k]
                }
            }
        }
        if understangs.allSatisfy({$0 >= X}) {
            lowestCost = min(lowestCost, cost)
        }
    }
    print(lowestCost == Int.max ? -1 : lowestCost)
}

main()
