#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

vector< vector<int> > sum_of_all_subset ( vector< vector<int> > s){
    int n = s.size() ;
    vector< vector<int> > results(1 << n ,vector<int>(s[0].size()));     // ( 1 << n )= 2^n

    // iterate through all subsets
 
    for( int i = 0 ; i < ( 1 << n ) ; ++ i ) {    // for each subset, O(2^n)
        for ( int j = 0; j < n ; ++ j ) {       // check membership, O(n)
            if ( ( i & ( 1 << j ) ) != 0 )    // test if bit ‘j’ is turned on in subset ‘i’?
                {
                    rep(k,0,s[0].size())
                    {
                        results[i][k] += s[j][k];
                    }  
                }       // if yes, process ‘j’
        }
    }

    return results;
}

void solve()
{
    int n,m,x;
    cin>>n>>m>>x;

    vector< vector<int> > v(n,vector<int>(m+1));

    rep(i,0,n)
    {
        rep(j,0,m+1)
        {
            cin>>v[i][j];
        }
    }
    // const int l = n;
    // bitset<12> bs;

    vector< vector<int> > ans = sum_of_all_subset(v);
    int f = inf;
    rep(i,0,ans.size())
    {
        int found = 0;
        rep(j,1,ans[i].size())
        {
            if ( ans[i][j] < x )
            {
                found = 1;
                break;
            }
        }

        if ( found == 0 )
        {
            f = min(f,ans[i][0]);
        }
    }

    if ( f == inf )
    {
        cout<<"-1"<<endl;
    }
    else
    {
        cout<<f<<endl;
    }
    

}

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

Measured memory_bytes: 3924