#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


int n,m,x;
struct b {
  int c;
  int a[20];
};
vector<struct b> bs;

int check(int mask) {
  vector<int> v(n);
  for(int i = 0; i < n; ++i ) {
    if( (mask & (1 << i)) != 0 ) {
      for(int j = 0; j < m; ++j) {
        v[j] += bs[i].a[j];
      }
    }
  }
  int ok = 1;
  for(int i = 0; i < m; ++i) {
    if( v[i] >= x) continue;
    else {
      ok = 0;
      break;
    }
  }
  return ok;
}

int cost(int mask) {
  int ret = 0;
  for(int i = 0; i < n; ++i ) {
    if( (mask & (1 << i)) != 0 ) {
      ret += bs[i].c;
    }
  }
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> x;
  bs.resize(n);
  REP(i,n) {
    int c;
    cin >> c;
    bs[i].c = c;
    REP(j,m) {
      int a2;
      cin >> a2;
      bs[i].a[j] = a2;
    }
  }
 // REP(i,n) {
 //   cout << bs[i].c << endl;
 //   REP(j,m) {
 //      cout << bs[i].a[j] << " " << endl;
 //   }
 //   cout << endl;
 // }
  int ret = 1e9;
  for(int mask = 0 ; mask < (1 << n) ; ++mask) {
    if( check(mask) ) {
      ret = min(ret,cost(mask));
    } 
  
  }
  if( ret != 1e9 ) {
    cout << ret << endl;
  }else {
    cout << -1 << endl;
  }


  return 0;
}

