#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
  int a[10010][10010];
int main(){
 int n,m,x; ll ans=9999999999999;
  cin>>n>>m>>x;
  vector<int> c(n);
  rep(i,n){
    cin>>c[i];
    rep(j,m)cin>>a[i][j];
  }
  rep(i,1<<n){
    ll cost=0; vector<ll> t(m); rep(j,m) t[j]=0; bool flag=true;
   rep(j,n){
    if(i>>j&1){
     cost += c[j];
      rep(k,m) t[k] += a[j][k];
    }
   }
   rep(j,m){
     if(t[j]<x) flag = false;
   }
    if(flag) ans=min(ans,cost);
  }
  if(ans==9999999999999){
  cout<<-1<<endl;
  }else{
  cout<<ans<<endl;
  }
}
