#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;
// 変数初期化
vector<ll> bsv; // binary_search用のvector
ll a,b,c,n,m;
typedef pair<ll, ll> Pll;
vector<Pll> facts; // 素因数分解の結果格納用(基数:乗数)
vector<vector<ll> > bit_search_v; //nit全探索の結果格納用

// index が条件を満たすかどうか
bool isOK(ll index, ll key) {
    if (bsv[index] >= key) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
ll binary_search(int key) {
    int ng = -1;
    int ok = (ll)bsv.size();

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    // OK(key以上となる)のindex番号を返す
    return ok;
}

// 最大公約数
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

// 最小公倍数
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

//　素因数分解
void prime_fact(ll target){
    ll base=2, exp=0;
    while (base*base<=target) {
        while (target%base==0) {
            target /= base; exp++;
        }
        if (exp>0) {
            facts.push_back(make_pair(base, exp));
        }
        base++; exp=0;
    }
    if (target>1) facts.push_back(make_pair(target,1));
}
// prime_factの結果の確認用
void print_facts(){
    for (int i=0; i<facts.size(); i++) {
        cout << facts[i].first << " " << facts[i].second << endl;
    }
}

vector<vector<ll> > A;

// bit全探索
void bit_search(ll target,int m,vector<ll> c){
    for (ll i=0; i<(1<<target); ++i) {
        if (i==0) continue;
        vector<ll> v(m+1);
        ll cc = 0;
        for (ll j=0; j<target; ++j) {
            if (i&(1<<j)) {
                cc+=c[j];
                for(ll k = 0; k < m;k++){
                    v[k] += A[j][k];
                }
            }
        }
        v[m] = cc;
        bit_search_v.push_back(v);
    }
}
// bit全探索の結果確認用
void print_bit_search(ll x){

    ll ans = MOD;

    for(ll i = 0; i < bit_search_v.size();i++){
        bool f = true;
        for(ll l = 0; l < bit_search_v[i].size()-1;l++){
            if(bit_search_v[i][l] < x){
                f = false;
            }
        }
        if(f){
        ans = min(ans,bit_search_v[i][bit_search_v[i].size()-1]);

        }
    }

    if(ans == MOD) cout << -1 << endl;
    else cout << ans << endl;
}



int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,m,x;
    cin >> n >> m >> x;
    vector<ll> c(n),v(m);
    

    for(ll i = 0; i < n;i++){
        cin >> c[i];
        for(ll l = 0; l < m;l++){
            cin >> v[l];
        }
        A.push_back(v);
    }

    bit_search(n,m,c);
    print_bit_search(x);
    ll ans = MOD;


    return 0;
}

Measured memory_bytes: 3708