#include <bits/stdc++.h>
#define xout cout<<" "
#define xln cout<<"\n"
#define ll long long
#define pb push_back
using namespace std;
const int N=1010;
ll n,m,p,x,y,a[N][N];
ll dp[N][N][20][3];
bool vis[N][N][20][3];
ll dfs(int i,int j,int p,int t){
if(p < 0)return -1 ;
if(i>n||i<1||j>m||j<1)return 0;
if(a[i][j]==-1)return -1;
if(vis[i][j][p][t])return dp[i][j][p][t];
vis[i][j][p][t]=1;
ll &res=dp[i][j][p][t],g=-1;
res=a[i][j];
if(t==1){
g=max(dfs(i,j+1,p,t),g);
}
if(t==2){
g=max(dfs(i,j-1,p,t),g);
}
if(t==0){
g=max(g,dfs(i,j+1,p-1,1));
g=max(g,dfs(i,j-1,p-1,2));
}
g=max(g,dfs(i+1,j,p,0));
if(g==-1)res=-1;
else res=a[i][j]+g;
return res;
}
int main(){
cin>>n>>m;
cin>>p;
cin>>x>>y;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++)cin>>a[i][j];
}
ll res=dfs(x,y,p,0);
cout<<res;xln;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgeG91dCBjb3V0PDwiICIKI2RlZmluZSB4bG4gY291dDw8IlxuIgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIHBiIHB1c2hfYmFjawp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgTj0xMDEwOwpsbCBuLG0scCx4LHksYVtOXVtOXTsKbGwgZHBbTl1bTl1bMjBdWzNdOwpib29sIHZpc1tOXVtOXVsyMF1bM107CmxsIGRmcyhpbnQgaSxpbnQgaixpbnQgcCxpbnQgdCl7CiAgICBpZihwIDwgMClyZXR1cm4gLTEgOyAKICAgIGlmKGk+bnx8aTwxfHxqPm18fGo8MSlyZXR1cm4gMDsKICAgIGlmKGFbaV1bal09PS0xKXJldHVybiAtMTsKCiAgICBpZih2aXNbaV1bal1bcF1bdF0pcmV0dXJuIGRwW2ldW2pdW3BdW3RdOwogICA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