#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int a[1005][1005];
vector<pair<int, pair<int, int> > > v;
long long dp[1000005];
long long inv(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b % 2) res = (res * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      scanf("%d", &a[i][j]), v.push_back(pair<int, pair<int, int> >(
                                 a[i][j], pair<int, int>(i, j)));
  int r, c;
  scanf("%d%d", &r, &c);
  sort(v.begin(), v.end());
  int last = v[1].first;
  vector<int> updt;
  long long sum = 0, sumr = 0, sumr2 = 0, sumc = 0, sumc2 = 0;
  int cnt = 0;
  for (int i = 0; i < v.size(); i++) {
    int val = v[i].first;
    int y = v[i].second.first, x = v[i].second.second;
    if (val != last) {
      for (int j = 0; j < updt.size(); j++) {
        int idx = updt[j];
        int y = v[idx].second.first, x = v[idx].second.second;
        sum = (sum + dp[idx]) % mod;
        sumr = (sumr + y) % mod;
        sumc = (sumc + x) % mod;
        sumr2 = (sumr2 + y * y) % mod;
        sumc2 = (sumc2 + x * x) % mod;
        cnt++;
      }
      updt.clear();
    }
    updt.push_back(i);
    long long res = sum;
    res = (res + sumr2) % mod;
    res = (res + sumc2) % mod;
    res = (res + (long long)cnt * y * y) % mod;
    res = (res + (long long)cnt * x * x) % mod;
    res = (res - 2 * y * sumr % mod + mod) % mod;
    res = (res - 2 * x * sumc % mod + mod) % mod;
    res = (res * inv(cnt, mod - 2)) % mod;
    dp[i] = res;
    if (r == y && c == x) return !printf("%lld\n", dp[i]);
    last = val;
  }
}
