#include <bits/stdc++.h>
using std::sort;
const int mod = 998244353;
int n, m, tot;
struct Node {
  int x, y;
  int val;
  bool operator<(const Node &a) const & { return val < a.val; }
} a[(1000 + 5) * (1000 + 5)];
int r, c;
int deg[(1000 + 5) * (1000 + 5)], inv[(1000 + 5) * (1000 + 5)];
int f[(1000 + 5) * (1000 + 5)];
struct Sum {
  int f, x2, y2, x, y;
} cur, last;
int Read() {
  char ch = getchar();
  int res = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar();
  return res;
}
int Pow(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) res = (long long)res * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return res;
}
int main() {
  n = Read(), m = Read();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      a[++tot].val = Read(), a[tot].x = i, a[tot].y = j;
  r = Read(), c = Read();
  sort(a + 1, a + tot + 1);
  while (a[tot].x != r || a[tot].y != c) --tot;
  deg[1] = 0;
  for (int i = 2; i <= tot; ++i) {
    if (a[i].val != a[i - 1].val)
      deg[i] = i - 1, inv[i] = Pow(deg[i], mod - 2);
    else
      deg[i] = deg[i - 1], inv[i] = inv[i - 1];
  }
  for (int i = 1; i <= tot; ++i) {
    if (deg[i] != deg[i - 1]) cur = last;
    f[i] = (cur.f +
            ((long long)a[i].x * a[i].x + (long long)a[i].y * a[i].y) % mod *
                deg[i] +
            cur.x2 + cur.y2 -
            2 * ((long long)a[i].x * cur.x + (long long)a[i].y * cur.y)) %
           mod * inv[i] % mod;
    last.f = (last.f + f[i]) % mod;
    last.x = (last.x + a[i].x) % mod;
    last.y = (last.y + a[i].y) % mod;
    last.x2 = (last.x2 + (long long)a[i].x * a[i].x % mod) % mod;
    last.y2 = (last.y2 + (long long)a[i].y * a[i].y % mod) % mod;
  }
  printf("%d", (f[tot] % mod + mod) % mod);
  return 0;
}
