#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db; 
typedef string str; 

typedef pair<int,int> pi;
typedef pair<ll,ll> pl; 
typedef pair<db,db> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<db> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 
typedef vector<pd> vpd;
/* typedef unordered_set<int> usi; */
/* typedef unordered_set<char> usc; */

#define endl '\n'

#define pb push_back
#define mp make_pair
#define f first
#define s second

#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()

// Loops
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define f0r(i,a) FOR(i,0,a)
#define f1r(i,a) FOR(i,1,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define r0f(i,a) ROF(i,0,a)
#define r1f(i,a) ROF(i,1,a)
#define trav(a,x) for (auto& a: x)

// constants
const int dx[4] = {0,-1,1,0}, dy[4] = {1,0,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1}, ddy[8] = {1,1,1,0,0,-1,-1,-1};

// to_string
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
template<class A> str ts(complex<A> c) { 
	stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) { 
	str res = "{"; f0r(i,sz(v)) res += char('0'+v[i]);
	res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
	str res = ""; f0r(i,SZ) res += char('0'+b[i]);
	return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { // containers with begin(), end()
	bool fst = 1; str res = "{\n\t";
	for (const auto& x: v) {
		if (!fst) res += ", \n\t";
		fst = 0; res += ts(x);
	}
	res += "\n}"; return res;
}
template<class A, class B> str ts(pair<A,B> p) {
	return "("+ts(p.f)+", "+ts(p.s)+")"; }

// cin
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(db& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }

// cout
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) { 
	pr(h); pr(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) { 
	pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

// debug
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << ts(h); if (sizeof...(t)) cerr << ", ";
	DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// io
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(string s = "") {
	unsyncIO();
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

int n,m,x;
int main(){
    re(n,m,x);
    m++;
    vector<vi> a(n);
    f0r(i,n){
        a[i] = vi(m+1);
        f0r(j,m){
            re(a[i][j]);
        }
    }
    int r=-1;
    vi p(m);
    bool yes;
    f0r(b,1<<n){
        fill(all(p),0);
        f0r(i,n){
            if(b&(1<<i)){
                f0r(j,m){
                    p[j]+=a[i][j];
                }
            }
        }
        yes=true;
        f1r(i,m){
            if(p[i]<x){
                yes=false;
                break;
            }
        }
        if(yes){
            r=r==-1||p[0]<r?p[0]:r;
        }
    }
    ps(r);
    return 0;
}


Measured memory_bytes: 3668