#include <stdio.h>

typedef long long ll;

int main(void) {
  int n, m, x;
  scanf("%d%d%d", &n, &m, &x);
  ll c[13] = {0};
  ll a[13][13] = {0};
  for(int i = 1;i <= n;i++) {
    scanf("%lld", c + i);
    c[i] += c[i-1];
    for(int j = 1;j <= m;j++) {
      scanf("%lld", &a[i][j]);
      a[i][j] += a[i-1][j];
    }
  }
  ll ret = c[n];
  int clear = 0;
  for(int i = 1;i < n;i++) {
    for(int j = i + 1;j <= n;j++) {
      int flag = 1;
      for(int k = 1;k <= m;k++) {
        if(a[j][k] - a[i][k] < x) {
          flag = 0;
          break;
        } 
      }
      if(flag) {
        if(ret > c[j] - c[i]) {
          clear++;
          ret = c[j] - c[i];
        }
      }
    }
  }
  if(!clear) printf("-1\n");
  else  printf("%lld\n", ret);
  return 0;
}
