#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;

int main(){
    while(true){
        int C,D,W,X;
        cin >> C >> D >> W >> X;
        if(C == 0) break;
        vector<vector<int> > E(C,vector<int>(D+1));
        vector<vector<int> > F(C,vector<int>(D+1));

        for(int i=0;i<C;i++){
            for(int j=1;j<=D;j++){
                cin >> E[i][j];
            }
        }

        for(int i=0;i<C;i++){
            for(int j=1;j<=D;j++){
                cin >> F[i][j];
            }
        }


        vector<vector<vector<int> > > YOKARI(D+1,vector<vector<int> >(1000,vector<int>(100)));
        for(int i=1;i<=D;i++){
            for(int w=0;w<=W;w++){
                for(int x=0;x<=X;x++){
                    YOKARI[i][w][x] = YOKARI[i-1][w][x];
                }
            }

            for(int j=0;j<C;j++){
                if(E[j][i] == 0) continue;

                for(int k=0;k<=W;k++){
                    for(int l=0;l<=X;l++){
                        YOKARI[i][F[j][i]+k][l] = max(YOKARI[i-1][k][l] + E[j][i],YOKARI[i][F[j][i]+k][l]);
                    }
                }


                for(int typ=0;typ<2;typ++){
                    int nowe=E[j][i],nowf=F[j][i];
                    if(typ == 0){
                        for(int lef=j-1;lef>=0;lef--){
                            if(E[lef][i] == 0) break;
                            nowe += E[lef][i];
                            nowf += F[lef][i];

                            for(int k=0;k<=W;k++){
                                for(int l=0;l<=X;l++){
                                //if(nowf + k > W) continue;
                                //if(l == X) continue;
                                    YOKARI[i][nowf+k][l+1] = max(YOKARI[i-1][k][l] + nowe,YOKARI[i][nowf+k][l+1]);
                                }
                            }

                        }
                    }else{
                        for(int lef=j+1;lef<C;lef++){
                            if(E[lef][i] == 0) break;
                            nowe += E[lef][i];
                            nowf += F[lef][i];

                            for(int k=0;k<=W;k++){
                                for(int l=0;l<=X;l++){
                                    //if(nowf + k > W) continue;
                                    //if(l == X) continue;
                                    YOKARI[i][nowf+k][l+1] = max(YOKARI[i-1][k][l] + nowe,YOKARI[i][nowf+k][l+1]);
                                }
                            }
                        }
                    }
                }
            }
        }

        int maxi = 0;
        for(int i=0;i<=W;i++){
            for(int j=0;j<=X;j++){
                maxi = max(YOKARI[D][i][j],maxi);
            }
        }
        cout << maxi << endl;
    }
    return 0;
}

Measured memory_bytes: 14800