#include <bits/stdc++.h>
using namespace std;
const int MaxR=50;
const int MaxC=50;
int people[MaxR][MaxC]={0};
int save[MaxR][MaxC]={0};
int R,C,k,m;
void move(int people[MaxR][MaxC], int save[MaxR][MaxC], int k, int R, int C) {
for(int i=0;i<R;i++){
for(int j=0;j<C;j++){
int d=people[i][j]/k;
if(j+1<C && people[i][j+1]>=0){
save[i][j]-=d;
save[i][j+1]+=d;
}
if(j-1>=0 && people[i][j-1]>=0){
save[i][j]-=d;
save[i][j-1]+=d;
}
if(i+1<R && people[i+1][j]>=0){
save[i][j]-=d;
save[i+1][j]+=d;
}
if(i-1>=0 && people[i-1][j]>=0){
save[i][j]-=d;
save[i-1][j]+=d;
}
}
}
for(int i=0;i<R;i++)
for(int j=0;j<C;j++)
people[i][j]=save[i][j];
}
int main(){
cin>>R>>C>>k>>m;
for(int i=0;i<R;i++){
for(int j=0;j<C;j++){
cin>>people[i][j];
save[i][j]=people[i][j];
}
}
for(int x=1;x<=m;x++){
move(people, save,k,R,C);
}
//找最小
int Min=people[0][0];
for(int i=0;i<R;i++){
for(int j=0;j<C;j++){
if(people[i][j]<Min)
if(people[i][j]!=-1)
Min=people[i][j];
}
}
cout<<Min<<"\n";
//找最大
int Max=people[0][0];
for(int i=0;i<R;i++){
for(int j=0;j<C;j++){
if(people[i][j]>Max)
Max=people[i][j];
}
}
cout<<Max;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTWF4Uj01MDsKY29uc3QgaW50IE1heEM9NTA7CmludCBwZW9wbGVbTWF4Ul1bTWF4Q109ezB9OwppbnQgc2F2ZVtNYXhSXVtNYXhDXT17MH07CmludCBSLEMsayxtOwp2b2lkIG1vdmUoaW50IHBlb3BsZVtNYXhSXVtNYXhDXSwgaW50IHNhdmVbTWF4Ul1bTWF4Q10sIGludCBrLCBpbnQgUiwgaW50IEMpIHsKCglmb3IoaW50IGk9MDtpPFI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