#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;


int main(){
    //ll N, M, X;
    //cin >> N >> M >> X;
    //vector<pair<ll, vector<ll>>> P(12);
    //REP(i, 12) {
    //    vector<ll> A(M);
    //    REP(m, M) A[m] = 0;
    //    P[i].second = A;
    //}
    //REP(i, N) {
    //    ll C;
    //    cin >> C;
    //    vector<ll> A(M);
    //    REP(m, M) A[m] = 0;
    //    REP(m, M) cin >> A[m];
    //    P[i].first = C;
    //    P[i].second = A;
    //}

    //ll ans = 1e17;
    //ll n = 12;
    //ll A = (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5) | (1<<6) | (1<<7) | (1<<8) | (1<<9) | (1<<10) | (1<<11) | (1<<12);
    //for (ll bit = A;;bit=(bit-1)&A) {
    //    vector<ll> S;
    //    REP(i, n) {
    //        if (bit & (1<<i)) S.push_back(i);
    //    }
    //    ll sum = 0;
    //    vector<ll> skill(M);
    //    REP(i, M) skill[i] = 0;
    //    REP(i, S.size()) {
    //        sum += P[i].first;
    //        REP(m, M) {
    //            skill[m] += P[i].second[m];
    //        }
    //    }
    //    bool can = true;
    //    REP (i, M) if (skill[i] < X) can = false;
    //    if (can) {
    //        chmin(ans, sum);
    //        REP(j, S.size()) cout << S[j];
    //        cout << "\n";
    //    }
    //    if (!bit) break;
    //}
    //if (ans == 1e17) ans = -1;
    //cout << ans << "\n";


    ll N, M, X;
    cin >> N >> M >> X;
    vector<ll> C(N);
    vector<vector<ll>> A(N);
    REP(i, N) {
        cin >> C[i];
        vector<ll> a(M);
        REP(j, M) cin >> a[j];
        A[i] = a;
    }

    ll ans = 1e17;
    for(ll bit=0; bit<(1<<N); bit++) {
        vector<ll> S;
        REP(i, N) if (bit&(1<<i)) S.push_back(i);
        vector<ll> skill(M);
        REP(i, M) skill[i] = 0;
        ll sum = 0;
        REP(i, S.size()) {
            ll num = S[i];
            sum += C[num];
            REP(m, M) {
                skill[m] += A[num][m];
            }
        }
        bool can = true;
        REP (i, M) if (skill[i] < X) can = false;
        if (can) chmin(ans, sum);
    }

    if (ans == 1e17) ans = -1;
    cout << ans << "\n";
}


Measured memory_bytes: 3664