// 🐋💭
import Foundation

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

func main() {
    let nmx = readInts()
    let (n, m, x) = (nmx[0], nmx[1], nmx[2])
    /// 金額の配列
    var aryCost = [Int]()
    /// 理解度の多次元配列
    var tableUnst = [[Int]]()
    
    for _ in 0..<n {
        let ca = readInts()
        aryCost.append(ca[0])
        tableUnst.append(Array(ca[1...m]))
    }
    //________________________________________ここまで入力
    
    var ans = Int.max
    // bit全探索で解を求める
    for bit in 0..<(1<<n) {
        var res = 0
        var aryUnst = [Int](repeating: 0, count: m)
        
        for i in 0..<n {
            if bit >> i & 1 == 1 {
                res += aryCost[i]
                
                
                for j in 0..<m {
                    aryUnst[j] += tableUnst[i][j]
                }
            }
        }
        if aryUnst.min()! >= x {
            ans = min(res, ans)
        }
    }
    print(ans == Int.max ? -1: ans)
}
main()
