func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func readThreeInts(separator: String.Element = " ") -> (a: Int, b: Int, c: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1], c: ints[2])
}

struct Book {
    let price: Int
    let points: [Int]

    static func decode() -> Book {
        var array = readInts()
        return Book(price: array.removeFirst(), points: array)
    }
}

func mainC() {
    let (N, M, X) = readThreeInts()
    let books = (0..<N).map { _ in Book.decode() }

    var results: [Int] = []
    // 1 ~ 2^Nまで
    // YES/NO問題, 二進数に変換して調べる
    for i in 0...(1<<N - 1) {
        var takahasi: [Int] = .init(repeating: 0, count: M)
        var price = 0

        for j in 0..<N {
            if ((i >> j) & 1) == 0 {
                takahasi = takahasi.enumerated().map { (index, element) in
                    return element + books[j].points[index]
                }
                price += books[j].price
            }
        }

        if takahasi.allSatisfy({ $0 >= X }) {
            results.append(price)
        }
    }

    if results.isEmpty {
        print(-1)
    } else {
        print(results.min()!)
    }
}
mainC()