/*Saurav Paul*/
#include<bits/stdc++.h>
using namespace std;

#define ll 					  long long int
#define boost		          ios_base::sync_with_stdio(0);
#pragma GCC optimize("O3")
#define loop(i,a,b)           for(ll i=a;i<=b;++i)
#define eb                    emplace_back
#define itoc(c)               ((char)(((int)'0')+c))
#define ctoi(c)               ((int)(((int)c)-'0'))
#define all(p)                p.begin(),p.end()
#define bug()				  debug() <<

///////////////////////

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef PAUL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define dbg(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#ifdef ONLINE_JUDGE
#define cerr if (false) cerr
#endif

///////////////////////
const int INF = 1e9 + 90;
const ll LINF = 1e18 + 90 ;
using pii = pair<int,int >;
using vec = vector<int> ;

template<typename T>T set_bit(T N,T pos){return N=N | (1<<pos);}
template<typename T>T reset_bit(T N,T pos){return N= N & ~(1<<pos);}
template<typename T> bool check_bit(T N,T pos){return (bool)(N & (1<<pos));}
template<typename T>void bin_print(T N){bitset<25>bit(N);cerr<<bit.to_string()<<"\n";}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long int n , m , x ;
    cin >> n >> m >> x ;

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

    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j <= m ; j++){
            cin >> v[i][j] ;
            //cnt[j] += v[i][j] ;
        }

    }

    long long int mn = INT_MAX ;
    bool ok = false ;
    int lim = pow(2, n) ;
    for(int t = 1 ; t <= lim ; t++){
        vector<long long int> cnt(m+1) ;
        for(int j = 0 ; j < n ; j++){
            if(check_bit(t,j)){
                for(int i = 0 ; i <= m ; i++){
                    cnt[i] += v[j][i] ;
                }
            }
        }
        // checking ...
        bool c = true ;
        bug() dbg(t) dbg(cnt) ;
        for(int i = 1 ; i <= m ; i++){
            if(cnt[i] < x){
                c = false ;
            }
        }
        if(c){
            ok = true ;
            mn = min(mn, cnt[0]) ;
        }
    }
    cout << (ok? mn : -1) << endl ;
    /*
    for(int i = 1 ; i<= m ; i++){
        if(cnt[i] < x){
            cout << -1 << endl ;
            return 0 ;
        }
    }
    for(int i = 0 ; i < n ; i++){
        for(int j = i + 1; j < n ; j++){
            if(v[i][0] > v[j][0]){
                swap(v[i] , v[j]) ;
            }
        }
    }

    long long int cost = cnt[0] ;

    for(int i = n -1 ; i >= 0 ; i--){
        bool ok = true ;
        for(int j = 1 ; j <= m ; j++){
            if(cnt[j] - v[i][j] < x){
                ok = false ;
                break ;
            }
        }
        if(ok){
            for(int j = 1 ; j <= m ; j++){
                cnt[j] -= v[i][j] ;
            }
            cost -= v[i][0] ;
        }
    }
    cout << cost << endl ;
    bug() dbg(v) ;
    bug() dbg(cnt) ;
    */

    return 0;
}


Measured memory_bytes: 4096