#include <bits/stdc++.h>
using namespace std;
#define ll long long
struct xy {
int x, y;
};
int h, w, zx, p, q;
ll ans, s[505][505];
bool vis[505][505];
int py[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
void bfs (int bx, int by) {
vis[bx][by] = 1;
queue <xy> q;
queue <xy> tq;
q.push((xy) {
bx, by
});
tq.push((xy) {
bx, by
});
ans += s[bx][by];
bool de = 1;
while (de) {
de = 0;
while (!q.empty()) {
int tx = q.front().x;
int ty = q.front().y;
q.pop();
for (int i = 0; i < 4; ++i) {
int ttx = tx + py[i][0];
int tty = ty + py[i][1];
if (s[ttx][tty] * zx >= ans || ttx < 1 || ttx > h || tty < 1 || tty > w || vis[ttx][tty]) {
continue;
}
q.push((xy) {
ttx, tty
});
tq.push((xy) {
ttx, tty
});
ans += s[ttx][tty];
vis[ttx][tty] = 1;
de = 1;
}
}
swap(tq, q);
}
return;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> h >> w >> zx >> p >> q;
for (int i = 1; i <= h; ++i) {
for (int j = 1; j <= w; ++j) {
cin >> s[i][j];
}
}
bfs(p, q);
cout << ans;
return 0;
}