#include <stdio.h>
#define min(a, b) ((a)>(b) ? (b) : (a))

int n, m, x;
int a[14][14];
int c[14];
int ans = 10000000;
int flag = 1;

void dfs(int num, int algo[], int cost) {
    if(num == n) {
        for(int i = 1; i <= m; i++) {
            if(algo[i] < x) {
                break;
            }
            if(i == m) {
                ans = min(ans, cost);
                flag = 0;
            }
        }
        return;
    }
 
  if(1) {
    dfs(num + 1, algo, cost);
    int newa[14] = {0};
    
    for(int i = 1; i <= m; i++) {
        newa[i] = algo[i] + a[num+1][i];
        dfs(num+1, newa, cost+c[num+1]);
    }
  }
}

int main() {
  scanf("%d %d %d", &n, &m, &x);
  
  for(int i = 1; i <= n; i++) {
      scanf("%d", &c[i]);
      for(int j = 1; j <= m; j++) {
          scanf("%d", &a[i][j]);
    }
  }
  
  int algo[14] = {0};
  dfs(0, algo, 0);
  if(flag) {
      ans = -1;
  }
  printf("%d\n", ans);
  return 0;
}
