import Foundation

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

func main() {
    let line = readInt()
    let N = line[0]
    let M = line[1]
    let X = line[2]

    let books = (1...N).map { _ in readInt() }
    var ans = Int.max
    for bit in 0..<(1<<N) {
        var comb = [Int](repeating: 0, count:M )
        for i in 0..<N {
            if bit & (1 << i) > 0 {
                let book = books[i]
                comb = comb.enumerated().map { $1 + book[$0] }
            }
        }

        if comb[1...].allSatisfy({ $0 >= X}) {
            ans = min(ans, comb[0])
        }
    }

    if ans == Int.max {
        print(-1)
    } else {
        print(ans)
    }
}


main()