#define rep(i,n) for(int i=0;i<(n);i++)
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  vector<int> c(n);
  int a[n][m];
  rep(i,n){
    cin >> c[i];
    rep(j,m)
      cin >> a[i][j];
  }
  int ans=INT_MAX;
  rep(i,1<<n){
    int answer=0;
    vector<int> temp(m);
    rep(j,n){
      if((i>>j)&1){
        answer+=c[j];
        rep(k,m)temp[k]+=a[j][k];
      }
    }
    rep(j,m) if(temp[j]<x)answer=INT_MAX;
    ans=min(answer,ans);
  }
  cout <<(INT_MAX==ans?-1:ans) << endl;
  return 0;
}
