#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int c, d, w, x;
int gain[16][40];
int fuel[16][40];
int eSum[16][16][40];
int fSum[16][16][40];

int memo[40][6][60];
int calc(int day, int rest, int w) {
  if (w < 0 || rest < 0) { return -10000000; }
  if (day == d) { return 0; }
  if (memo[day][rest][w] != -1) { return memo[day][rest][w]; }
  int ret = calc(day + 1, rest, w);
  REP(i, c) {
    ret = max(ret, calc(day + 1, rest, w - fuel[i][day]) + gain[i][day]);
  }
  REP(e, c) {
    REP(s, e + 1) {
      ret = max(ret, calc(day + 1, rest - 1, w - fSum[s][e][day]) + eSum[s][e][day]);
    }
  }
  return memo[day][rest][w] = ret;
}

int main() {
  while (scanf("%d %d %d %d", &c, &d, &w, &x), c|d|w|x) {
    MEMSET(memo, -1);
    MEMSET(eSum, 0);
    MEMSET(fSum, 0);
    REP(y, c) {
      REP(x, d) {
        scanf("%d", &gain[y][x]);
      }
    }
    REP(y, c) {
      REP(x, d) {
        scanf("%d", &fuel[y][x]);
      }
    }
    REP(e, c) {
      REP(s, e + 1) {
        REP(day, d) {
          FOREQ(i, s, e) {
            if (gain[i][day] == 0) {
              eSum[s][e][day] -= 100000;
              fSum[s][e][day] += 100;
            } else {
              eSum[s][e][day] += gain[i][day];
              fSum[s][e][day] += fuel[i][day];
            }
          }
        }
      }
    }
    printf("%d\n", calc(0, x, w));
  }
}