#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5 + 1000;
const int MAXT = MAXN * MAXN;
const long long MOD = 998244353LL;
int arr[MAXN][MAXN], N, M, sz;
pair<int, pair<int, int>> all[MAXT];
long long mul(long long a, long long b) { return (a * b) % MOD; }
void add(long long& a, long long b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
}
long long fpow(long long base, long long exp) {
  long long ans = 1LL, power = base;
  while (exp) {
    if (exp & 1) ans = mul(ans, power);
    power = mul(power, power);
    exp >>= 1;
  }
  return ans;
}
long long pre[MAXT];
long long solve(int r, int c) {
  long long tot = 0LL;
  long long xsq = 0LL, ysq = 0LL, xs = 0LL, ys = 0LL, x, y;
  for (int j, i = 0; i < sz; i = j) {
    long long fp = fpow(i, MOD - 2LL);
    for (j = i; j < sz && all[j].first == all[i].first; ++j) {
      tie(x, y) = all[j].second;
      if (i) {
        pre[j] = tot;
        add(pre[j], xsq);
        add(pre[j], ysq);
        add(pre[j], mul(mul(-2LL, x), xs));
        add(pre[j], mul(mul(-2LL, y), ys));
        pre[j] = mul(pre[j], fp);
        add(pre[j], mul(x, x));
        add(pre[j], mul(y, y));
      } else
        pre[j] = 0LL;
      if (x == r && y == c) return pre[j];
    }
    for (int k = i; k < j; ++k) {
      tie(x, y) = all[k].second;
      add(xs, x);
      add(ys, y);
      add(xsq, mul(x, x));
      add(ysq, mul(y, y));
      add(tot, pre[k]);
    }
  }
  assert(false);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  sz = 0;
  cin >> N >> M;
  for (int i = (int)0; i < (int)N; ++i)
    for (int j = (int)0; j < (int)M; ++j) {
      cin >> arr[i][j];
      all[sz++] = {arr[i][j], {i, j}};
    }
  int R, C;
  cin >> R >> C;
  sort(all, all + sz,
       [](const pair<int, pair<int, int>>& p,
          const pair<int, pair<int, int>>& q) -> bool {
         return p.first < q.first;
       });
  cout << solve(R - 1, C - 1);
  return 0;
}
