#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int64_t i=0;i<(int64_t)N;i++)
const int INF=0x7f7f7f7f;
int main()
{
  int N,M,X,check,cost,pay=INF;
  cin>>N>>M>>X;
  vector<int> C(N,0),up(M,0);
  vector<vector<int>> A(N,vector<int>(M,0));
  rep(i,N){cin>>C.at(i);rep(j,M)cin>>A.at(i).at(j);}
  rep(i,(1<<N))
  {
    cost=0;rep(k,M)up.at(k)=0;
    rep(j,N)
    {
      if((i>>j)%2)
      {
        cost+=C.at(j);check=1;
        rep(k,M){up.at(k)+=A.at(j).at(k);check&=((up.at(k)<X)?0:1);}
        if(check)pay=(cost<pay)?cost:pay;
      }
    }
  }
  return printf("%d\n",(pay==INF)?-1:pay),0;
}