#include<bits/stdc++.h>
#define MOD 998244353
#define x(p) p.second.first
#define y(p) p.second.second
#define sqeud(a) (x(a)*x(a)+y(a)*y(a))
using namespace std;
typedef long long ll;
typedef pair<ll, pair<int, int>> p3;
ll modpow(ll a, ll n) {
if(n == 0 or a == 1) return 1;
else if(n == 1) return a;
if(n&1) return (a * modpow(a, n-1)) % MOD;
ll temp = modpow(a, n / 2);
return (temp*temp) % MOD;
}
ll modinv(ll a) {
return modpow(a, MOD-2);
}
int main() {
ios::sync_with_stdio(false);
#ifdef DBG
freopen("in", "r", stdin);
#endif
int n, m, r, c;
cin>>n>>m;
vector<p3> arr(n*m);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
int ind = i*m + j;
cin>>arr[ind].first;
arr[ind].second = {i + 1, j + 1};
}
}
cin>>r>>c;
sort(arr.begin(), arr.end());
vector<ll> sqsum(n*m, 0);
vector<ll> xsum(n*m, 0);
vector<ll> ysum(n*m, 0);
vector<ll> vsum(n*m, 0);
// int i;
ll v;
for(int i = 0; i < n*m; i++) {
if(i == 0) {
sqsum[i] = sqeud(arr[i]);
xsum[i] = x(arr[i]);
ysum[i] = y(arr[i]);
} else {
sqsum[i] = (sqsum[i-1] + sqeud(arr[i]))%MOD;
xsum[i] = xsum[i-1] + x(arr[i]);
ysum[i] = ysum[i-1] + y(arr[i]);
}
if(x(arr[i]) == r and y(arr[i]) == c) {
v = arr[i].first;
}
}
ll ans = 0ll;
for(int i = n*m - 1; i > 0; i--) {
if(arr[i].first > v) continue;
else if(arr[i].first == v and (x(arr[i]) != r or y(arr[i]) != c)) continue;
p3 value = {arr[i].first, {-1, -1}};
int ind = lower_bound(arr.begin(), arr.end(), value) - arr.begin();
if(ind == 0) {
break;
}
ll count = ind;
ind--;
ll count_inv = modinv(count);
ll val = (count*sqeud(arr[i]))%MOD;
val = (val + sqsum[ind])%MOD;
val -= (2*x(arr[i])*xsum[ind]);
val -= (2*y(arr[i])*ysum[ind]);
while(val < 0) {
val += MOD;
}
val = (val * count_inv) % MOD;
ans = (ans + val) % MOD;
}
cout<<ans;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBNT0QgOTk4MjQ0MzUzCiNkZWZpbmUgeChwKSBwLnNlY29uZC5maXJzdAojZGVmaW5lIHkocCkgcC5zZWNvbmQuc2Vjb25kCiNkZWZpbmUgc3FldWQoYSkgKHgoYSkqeChhKSt5KGEpKnkoYSkpCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgcGFpcjxsbCwgcGFpcjxpbnQsIGludD4+IHAzOwoKbGwgbW9kcG93KGxsIGEsIGxsIG4pIHsKICAgIGlmKG4gPT0gMCBvciBhID09IDEpIHJldHVybiAxOwogICAgZWxzZSBpZihuID09IDEpIHJldHVybiBhOwoKICAgIGlmKG4mMSkgcmV0dXJuIChhICogbW9kcG93KGEsIG4tMSkpICUgTU9EOwoKICAgIGxsIHRlbXAgPSBtb2Rwb3coYSwgbiAvIDIpOwogICAgcmV0dXJuICh0ZW1wKnRlbXApICUgTU9EOwp9CgpsbCBtb2RpbnYobGwgYSkgewogICAgcmV0dXJuIG1vZHBvdyhhLCBNT0QtMik7Cn0KCgoKaW50IG1haW4oKSB7CiAgICBpb3M6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CgoKICAgICNpZmRlZiBEQkcKICAgIGZyZW9wZW4oImluIiwgInIiLCBzdGRpbik7CiAgICAjZW5kaWYKCiAgICBpbnQgbiwgbSwgciwgYzsKICAgIGNpbj4+bj4+bTsKCiAgICB2ZWN0b3I8cDM+IGFycihuKm0pOwoKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBmb3IoaW50IGogPSAwOyBqIDwgbTsgaisrKSB7CiAgICAgICAgICAgIGludCBpbmQgPSBpKm0gKyBqOwogICAgICAgICAgICBjaW4+PmFycltpbmRdLmZpcnN0OwogICAgICAgICAgICBhcnJbaW5kXS5zZWNvbmQgPSB7aSArIDEsIGogKyAxfTsKICAgICAgICB9CiAgICB9CiAgICBjaW4+PnI+PmM7CgogICAgc29ydChhcnIuYmVnaW4oKSwgYXJyLmVuZCgpKTsKCiAgICB2ZWN0b3I8bGw+IHNxc3VtKG4qbSwgMCk7CiAgICB2ZWN0b3I8bGw+IHhzdW0obiptLCAwKTsKICAgIHZlY3RvcjxsbD4geXN1bShuKm0sIDApOwogICAgdmVjdG9yPGxsPiB2c3VtKG4qbSwgMCk7CiAgICAvLyBpbnQgaTsKCiAgICBsbCB2OwoKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuKm07IGkrKykgewogICAgICAgIGlmKGkgPT0gMCkgewogICAgICAgICAgICBzcXN1bVtpXSA9IHNxZXVkKGFycltpXSk7CiAgICAgICAgICAgIHhzdW1baV0gPSB4KGFycltpXSk7CiAgICAgICAgICAgIHlzdW1baV0gPSB5KGFycltpXSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc3FzdW1baV0gPSAoc3FzdW1baS0xXSArIHNxZXVkKGFycltpXSkpJU1PRDsKICAgICAgICAgICAgeHN1bVtpXSA9IHhzdW1baS0xXSArIHgoYXJyW2ldKTsKICAgICAgICAgICAgeXN1bVtpXSA9IHlzdW1baS0xXSArIHkoYXJyW2ldKTsKICAgICAgICB9CgogICAgICAgIGlmKHgoYXJyW2ldKSA9PSByIGFuZCB5KGFycltpXSkgPT0gYykgewogICAgICAgICAgICB2ID0gYXJyW2ldLmZpcnN0OwogICAgICAgIH0KICAgIH0KCiAgICBsbCBhbnMgPSAwbGw7CgogICAgZm9yKGludCBpID0gbiptIC0gMTsgaSA+IDA7IGktLSkgewogICAgICAgIGlmKGFycltpXS5maXJzdCA+IHYpIGNvbnRpbnVlOwogICAgICAgIGVsc2UgaWYoYXJyW2ldLmZpcnN0ID09IHYgYW5kICh4KGFycltpXSkgIT0gciBvciB5KGFycltpXSkgIT0gYykpIGNvbnRpbnVlOwogICAgICAgIAogICAgICAgIHAzIHZhbHVlID0ge2FycltpXS5maXJzdCwgey0xLCAtMX19OwogICAgICAgIGludCBpbmQgPSBsb3dlcl9ib3VuZChhcnIuYmVnaW4oKSwgYXJyLmVuZCgpLCB2YWx1ZSkgLSBhcnIuYmVnaW4oKTsKICAgICAgICBpZihpbmQgPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgbGwgY291bnQgPSBpbmQ7CiAgICAgICAgaW5kLS07CiAgICAgICAgbGwgY291bnRfaW52ID0gbW9kaW52KGNvdW50KTsKICAgICAgICBsbCB2YWwgPSAoY291bnQqc3FldWQoYXJyW2ldKSklTU9EOwoKICAgICAgICB2YWwgPSAodmFsICsgc3FzdW1baW5kXSklTU9EOwogICAgICAgIHZhbCAtPSAoMip4KGFycltpXSkqeHN1bVtpbmRdKTsKICAgICAgICB2YWwgLT0gKDIqeShhcnJbaV0pKnlzdW1baW5kXSk7CiAgICAgICAgd2hpbGUodmFsIDwgMCkgewogICAgICAgICAgICB2YWwgKz0gTU9EOwogICAgICAgIH0KCiAgICAgICAgdmFsID0gKHZhbCAqIGNvdW50X2ludikgJSBNT0Q7CiAgICAgICAgYW5zID0gKGFucyArIHZhbCkgJSBNT0Q7CiAgICB9CiAgICBjb3V0PDxhbnM7CiAgICByZXR1cm4gMDsKfQ==