#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i < (n); ++i)
#define repD(i, a, n) for(ll i = a; i > (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
// #define mp make_pair
#define pb push_back
// #define endl "\n"
#define MAXN 5000000
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
int Ceil(int a, int b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}
ll p=1000000007;
float E = 0.00000000000001;
ll power(ll x, ll y){
    if(y==0){
        return 1;
    }
    if(y%2==0){
        ll q=power(x,y/2);
        q=q%p;
        return (q*q)%p;
    }
    ll q=power(x,y/2);
    q=q%p;
    return ((x%p)*((q*q)%p))%p; 
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}

bool isPowerOfTwo (int x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}  

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a); 
}
long long int mod(long long int a, long long int b) {
    long long int ret = a%b; return ret>=0? ret: ret+b; 
}


long long int rec(long long int num, vector <long long int> &dp){
        if(num == 1)
            return 0;
        if(dp[num] != -1)
            return dp[num];
        else if(num%2)
            dp[num] = 1 + rec(3*num + 1, dp);
        else
            dp[num] = 1 + rec(num/2, dp);
        return dp[num];
    }
int getKth(int lo, int hi, int k) {
        vector <long long int> dp(10000, -1);
        vector < pair<long long int, long long int> > vec(hi - lo + 1);
        dp[0] = 0;
        dp[1] = 0;
        for(int i = lo ; i <= hi ; i++){
            vec[i - lo].first = rec(i, dp);
            vec[i - lo].second = i;
        }
        sort(vec.begin(), vec.end());
            // for(auto x:vec)
            //     cout<<x.second<<" ";
        return vec[k-1].second;
    }

void helper(vector<int> &und, vector<int> &cost, int index, int curr_cost, int &ans, int &x, vector<vector<int>> &a){
    // if(index == cost.size())
    //     return;
    int flag = 1;
    for(auto y:und)
        if(y < x)
            flag = 0;
    if(flag){
        // cout<<"Y";
        ans = min(ans, curr_cost);
        return;
    }
    for(int i = index ; i < cost.size() ; i++){
        int m = a[i].size();
        for(int j = 0 ; j < m ; j++)
            und[j] += a[i][j];
        helper(und, cost, i+1, curr_cost + cost[i], ans, x, a);
        for(int j = 0 ; j < m ; j++)
            und[j] -= a[i][j];
    }
}
int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);
    #endif

    int t;
    // cin>>t;
    t = 1;
    while(t--){
            int n,m,x;
            cin>>n>>m>>x;
            vector<int> und(m, 0);
            vector<int>cost(n);
            vector<vector<int>> a(n, vector<int>(m));
            for(int i = 0 ; i < n ; i++){
                cin>>cost[i];
                for(int j = 0 ; j < m ; j++){
                    cin>>a[i][j];
                }
            }
            // unordered_set <int> visited;
            int ans = INT_MAX;
            helper(und, cost, 0, 0, ans, x, a);
            ans = (ans == INT_MAX)?-1:ans;
            cout<<ans;
        }   
        return 0;
    }

Measured memory_bytes: 3644