#include <bits/stdc++.h>
using namespace std;
int main(void){
  
  int n,m,x,i,j;
  cin >> n >> m >> x;
  vector <vector<int> > a(n, vector<int>(m));
  vector <int> ans(12,0);
  int c[12];
  int money = 0,d=0;
  bool isOK = true;
  int count = 0;

  for(i=0;i<n;i++){
	cin >> c[i];
    for(j=0;j<m;j++){
     cin >> a[i][j];   
    }
    money += c[i];
  }
  
  int loop = (1 << n);

  int k;
  
  for(i=0;i<loop;i++){

    for(j=0;j<n;j++){
     if(i >> j & 1){ 
       for(k=0;k<m;k++){
      	ans[k] += a[j][k];
       }
      d += c[j];
     }
    }
    for(j=0;j<m;j++){
     if(ans[j] < x){
       isOK = false; 
     }
    }
    if(! isOK) count++;
    
    if(isOK == true & money > d){
     money = d;
    }
    isOK = true;
    d = 0;
    
    for(j=0;j<m;j++){
     ans[j] = 0; 
    }
  }
  
  if (count == loop){
    cout << -1;
    return 0;
  }
  cout <<  money;
  return 0;
}