// Skill Up

func sumVector(_ a: [Int], _ b: [Int]) -> [Int] {
    return (0..<a.count).map{i in
        a[i] + b[i]
    }
}

func main() {
    // n冊の本、m個のスキル、目標x
    let nmx = readLine()!.split(separator: " ").map{Int($0)!}
    let (n,m,x) = (nmx[0], nmx[1], nmx[2])

    var results: [[Int]] = [Array<Int>(repeating: 0, count: m+1)]

    for _ in 1...n {
        let ca = readLine()!.split(separator: " ").map{Int($0)!}
        let selected = results.filter{result in
            result[1...m].contains{$0 < x}
        }.map{result in
            sumVector(result, ca)
        }
        results += selected
    }
    let cleared = results.filter{$0[1...m].allSatisfy{$0 >= x}}
    if cleared.isEmpty {
        print(-1)
    }else {
        print(cleared.map{$0[0]}.min()!)
    }
}

main()