#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <iomanip>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

// i??\???????????´???j??§2?????\????????????????????°k??????????£????????????§???
ll dp[35][55][10];
ll E[20][35], F[20][35];

int main() {
	ll c, d, w, x;
	while(cin >> c >> d >> w >> x) {
		if(c == 0 && d == 0 && w == 0 && x == 0) break;

		memset(E, 0, sizeof(E));
		rep(i, c) {
			rep(j, d) cin >> E[i][j];
		}

		memset(F, 0, sizeof(F));
		rep(i, c) {
			rep(j, d) cin >> F[i][j];
		}

		// rep(i, c) {
		// 	rep(j, d) {
		// 		cout << "(" << E[i][j] << ", " << F[i][j] << ") ";
		// 	}
		// 	cout << endl;
		// }

		memset(dp, 0, sizeof(dp));

		rep(i, d) {
			rep(j, w + 1) {
				rep(k, x + 1) {
					dp[i+1][j][k] = max(dp[i+1][j][k], dp[i][j][k]);

					rep(s, c) {
						if(E[s][i] == 0) continue;

						ll sum = E[s][i];
						ll res = F[s][i];

						if(j + res <= w) {
							dp[i+1][j+res][k] = max(dp[i+1][j+res][k], dp[i][j][k] + sum);
						}

						REP(t, s + 1, c) {
							if(E[t][i] == 0) break;

							sum += E[t][i];
							res += F[t][i];

							if(j + res <= w && k + 1 <= x) {
								dp[i+1][j+res][k+1] = max(dp[i+1][j+res][k+1], dp[i][j][k] + sum);
							}
						}
					}
				}
			}
		}

		// rep(i, d + 1) {
		// 	cout << " ----- day : " << i << endl;
		// 	rep(j, w + 1) {
		// 		rep(k, x + 1) {
		// 			cout << setw(3) << dp[i][j][k] << " ";
		// 		}
		// 		cout << endl;
		// 	}
		// }
		
		ll ans = 0;
		// rep(i, d + 1) {
			rep(j, w + 1) {
				rep(k, x + 1) {
					ans = max(ans, dp[d][j][k]);
				}
			}
		// }

		cout << ans << endl;
	}

	return 0;
}