#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N, M, X, minM=1200001;
  cin >> N >> M >> X;
  vector<vector<int>> A(N, vector<int>(M+1));
  rep(i, N){
    rep(j, M+1) cin >> A.at(i).at(j);
  }
  rep(i, (1<<N)){
    bitset<12> bs(i);
    bool B=0;
    vector<int> SumA(M+1, 0);
    rep(j, N){
      rep(k, M+1) if(bs.test(j)) SumA.at(k)+=A.at(j).at(k);
    }
    rep(j, M){
      if(SumA.at(j+1)<X){
        B=1;
        break;
      }
    }
    if(B==0) minM=min(minM, SumA.at(0));
  }
  if(minM==1200001) cout << -1 << endl;
  else cout << minM << endl;
}