let input = readLine()!.split(separator: " ").map { Int($0)! }

let N = input[0]
let M = input[1]
let X = input[2]

struct Book {
  var price: Int
  var contents: [Int]
}

var books = [Book]()

for _ in 0 ..< N {
    let book = readLine()!.split(separator: " ").map { Int($0)! }
    books.append(Book(price: book[0], contents: Array(book[1 ... M])))
}

var result = Int.max
var all = 1 << N
var mask = 0

while mask < all {
    var level = Array(repeating: 0, count: M)
    var price = 0
    for i in 0 ..< N {
        if mask >> i & 1 == 1 {
            price += books[i].price
            for j in 0 ..< M {
                level[j] += books[i].contents[j]
            }
        }
        if level.first(where: { $0 < X }) == nil {
            result = min(result, price)
        }
    }
    mask += 1
}

print(result == Int.max ? "-1" : result)
