var fi,fo:text;
i,j,n,m,ct,r,c,max,p1,p2:longint;
d,int:array[1..1000] of integer;
a:array[1..1000,1..1000] of integer;
procedure sumlin(x:integer);
var sum,j:integer;
begin
sum:=0;
for j:=1 to n do
sum:=sum+a[x,j];
d[x]:=sum;
end;
procedure sumcol(x:integer);
var sum,i:integer;
begin
sum:=0;
for i:=1 to m do
sum:=sum+a[i,x];
d[x]:=sum;
end;
procedure cutl(x:integer);
var j:integer;
begin
for j:=1 to n do
if a[x,j]>0 then d[j]:=d[j]-a[x,j]
else d[j]:=d[j]+a[x,j];
inc(ct);
end;
procedure cutc(x:integer);
var i:integer;
begin
for i:=1 to m do
if a[i,x]>0 then d[i]:=d[i]-a[i,x]
else d[i]:=d[i]+a[i,x];
inc(ct);
end;
procedure part(left,right:longint; var stst,stdr,drst,drdr:longint);
var piv:longint;
i,j:longint;
aux:longint;
begin
piv:=d[(left+right) div 2];
i:=left-1;
j:=right+1;
while i<j do
begin
repeat inc(i); until d[i]<=piv;
repeat dec(j); until d[j]>=piv;
if i<j then
begin
aux:=d[i];
d[i]:=d[j];
d[j]:=aux;
end;
end;
stst:=left; drdr:=right;
if i=j then begin stdr:=j-1; drst:=i+1; end
else begin stdr:=j; drst:=i; end;
end;
procedure qsort(left,right:longint);
var stst,stdr,drst,drdr:longint;
begin
if left<right then
begin
part(left,right,stst,stdr,drst,drdr);
qsort(stst,stdr);
qsort(drst,drdr);
end;
end;
procedure gosolve;
var i,j,k,ss:longint;
begin
for i:=1 to n do
sumcol(i);
int:=d;
if n>=m then
for i:=1 to (1 shl m) do
begin
d:=int;
ct:=0;
for j:=1 to m do
begin
if ct>r then break;
if ((1 shl (j-1)) and i)<>0 then cutl(j);
end;
if ct=r then
begin
qsort(1,n);
ss:=0;
for k:=1 to n-c do
ss:=ss+d[k];
if ss>max then max:=ss;
// writeln(fo,max);
end;
end;
if n>=m then
begin
write(fo,max);
close(fo);
halt;
end;
for i:=1 to m do
sumlin(i);
int:=d;
if m>n then
for i:=1 to (1 shl n) do
begin
d:=int;
ct:=0;
for j:=1 to n do
begin
if ct>c then break;
if ((1 shl (j-1)) and i)<>0 then cutc(j);
end;
if ct=c then
begin
qsort(1,m);
ss:=0;
for k:=1 to m-r do
ss:=ss+d[k];
if ss>max then max:=ss;
//writeln(fo,max);
end;
end;
end;
begin
assign(fi,'elimin.in'); reset(fi);
assign(fo,'elimin.out'); rewrite(fo);
readln(fi,m,n,r,c);
for i:=1 to m do
for j:=1 to n do
read(fi,a[i,j]);
gosolve;
writeln(fo,max);
close(fi);
close(fo);
end.