#include <bits/stdc++.h>

//#define DEBUG

using namespace std;

struct tree_node{
    uint32_t cost;
    std::vector<uint32_t> algorithm_skill;
    tree_node* left;
    tree_node* right;
};

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}

void make_tree(tree_node* root, int MAX_DEPTH, 
                const std::vector<uint32_t>& C, const std::vector<std::vector<uint32_t>>& A,
                int current_depth, uint32_t& optimize_cost, uint32_t X){
    if( current_depth + 1 < MAX_DEPTH){
        tree_node* left = new tree_node;
        left->cost = root->cost;
        left->algorithm_skill = root->algorithm_skill;
        root->left = left;

        tree_node* right = new tree_node;
        right->cost = root->cost + C[current_depth + 1];
        std::vector<uint32_t> update_skill;
        for(int i = 0 ; i < root->algorithm_skill.size(); i++){
            update_skill.push_back(root->algorithm_skill[i] + A[current_depth + 1][i]);
        }
        right->algorithm_skill = update_skill;
        root->right = right;
        make_tree(left, MAX_DEPTH, C, A, current_depth+1, optimize_cost, X);
        make_tree(right, MAX_DEPTH, C, A, current_depth + 1, optimize_cost, X);
    }else{
        root->left = NULL;
        root->right = NULL;

        if( root->cost < optimize_cost){
            bool condition = true;
            for(int i = 0 ; i < root->algorithm_skill.size() ; i++){
                if(root->algorithm_skill[i] < X){
                    condition = false;
                    break;
                }
            }
            if(condition){
                optimize_cost = root->cost;
            }
        }
    }
}

uint32_t check_min_cost(tree_node* root, uint32_t X, uint32_t& current_min_cost){
    if(root -> left == NULL){
        if( root->cost < current_min_cost){
            bool condition = true;
            for(int i = 0 ; i < root->algorithm_skill.size() ; i++){
                if(root->algorithm_skill[i] < X){
                    condition = false;
                    break;
                }
            }
            if(condition){
                current_min_cost = root->cost;
            }
        }
    }else{
        check_min_cost(root->left, X, current_min_cost);
        check_min_cost(root->right, X, current_min_cost);
    }
}
void func_to_create(){
    uint32_t N, M, X;
    cin >> N >> M >> X;
    std::vector<uint32_t> C;
    std::vector<std::vector<uint32_t>> A;
    C.reserve(N);
    std::vector<uint32_t> algorithm_level(M, 0);
    uint32_t impossible_cost = 1;
    for(int i = 0 ; i < N ; i++){
        uint32_t cost; 
        cin >> cost;
        C.push_back(cost);
        impossible_cost += cost;
        for(int j = 0 ; j < M ; j++){
            uint32_t a;
            cin >> a;
            algorithm_level[j] = a;
        }
        A.push_back(algorithm_level);
    }
    uint32_t optimize_cost = impossible_cost;

    // make tree
    tree_node* root = new tree_node;
    root->cost = 0;
    std::vector<uint32_t> current_skill(M, 0);
    root->algorithm_skill = current_skill;
    make_tree(root, N, C, A, -1, optimize_cost, X);

    // check minimum cost
    //check_min_cost(root, X, optimize_cost);
    if( optimize_cost < impossible_cost){
        cout << optimize_cost << endl;
    }else{
        cout << -1 << endl;
    }



}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 3;
    while(TEST_CASES--){
    #endif // DEBBUG

    func_to_create();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


Measured memory_bytes: 4680