#include <bits/stdc++.h>
using namespace std;
int n, m, a[1005][1005], r, c;
long long slin, scol, splin, spcol, se, rez[1005][1005], aux[10], nrsm, nr, nrv;
struct ceva {
  long long i, j;
} v[1000005];
int expon(long long a, long long b) {
  long long rez = 1;
  while (b != 0) {
    if (b & 1) {
      rez *= a;
      rez %= 998244353;
    }
    b = b >> 1;
    a = a * a;
    a %= 998244353;
  }
  return rez;
}
int inv(int x) { return expon(x, 998244353 - 2); }
bool cmp(ceva x, ceva y) { return a[x.i][x.j] < a[y.i][y.j]; }
int main() {
  int i, j, A, B;
  long long val, VAL;
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) cin >> a[i][j];
  cin >> r >> c;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (a[i][j] <= a[r][c]) {
        nrv++;
        v[nrv].i = i;
        v[nrv].j = j;
      }
  sort(v + 1, v + nrv + 1, cmp);
  for (A = 1; A <= nrv;) {
    VAL = a[v[A].i][v[A].j];
    aux[1] = 0;
    aux[2] = 0;
    aux[3] = 0;
    aux[4] = 0;
    aux[5] = 0;
    nr = 0;
    long long invmod = inv(nrsm);
    B = A;
    while ((B <= nrv) && (a[v[B].i][v[B].j] == VAL)) {
      i = v[B].i;
      j = v[B].j;
      val = se + splin + spcol - 2LL * i * slin - 2LL * j * scol;
      while (val < 0) val += 998244353;
      val %= 998244353;
      if (nrsm != 0)
        rez[i][j] = ((i * i + j * j) % 998244353 + (val * invmod) % 998244353) %
                    998244353;
      aux[1] += i;
      aux[2] += j;
      aux[3] += i * i;
      aux[4] += j * j;
      aux[5] += rez[i][j];
      nr++;
      aux[1] %= 998244353;
      aux[2] %= 998244353;
      aux[3] %= 998244353;
      aux[4] %= 998244353;
      aux[5] %= 998244353;
      B++;
    }
    if (rez[r][c] != 0) {
      cout << rez[r][c];
      return 0;
    }
    slin += aux[1];
    scol += aux[2];
    splin += aux[3];
    spcol += aux[4];
    se += aux[5];
    nrsm += nr;
    slin %= 998244353;
    scol %= 998244353;
    splin %= 998244353;
    spcol %= 998244353;
    se %= 998244353;
    nrsm %= 998244353;
    A = B;
  }
  cout << rez[r][c];
  return 0;
}
