#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int MAXN = 1e6 + 5;
const int MAXM = 2e6 + 5;
const int MOD = 998244353;
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
long long pw(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void inc(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
void dec(long long &a, long long b) {
  a -= b;
  if (a < 0) a += MOD;
}
int mul(int a, int b) {
  long long c = 1ll * a * b;
  return c - c / MOD * MOD;
}
int n, m, k, a[1005][1005], V;
struct Node {
  int v, r, c;
} b[1000005];
bool cmp(Node a, Node b) { return a.v < b.v; }
long long SE, SR, SC, SRR, SCC, ans;
bool fst = true;
void gao(int l, int r, int flag) {
  int R, C;
  long long inv = pw(k, MOD - 2, MOD);
  k += r - l + 1;
  long long TE, TR, TC, TRR, TCC;
  TE = TR = TC = TRR = TCC = 0;
  for (int i = l; i < r + 1; i++) {
    R = b[i].r, C = b[i].c;
    if (!fst)
      TE = ((TE + R * R + C * C +
             (SE - 2ll * R * SR + SRR - 2ll * C * SC + SCC) % MOD * inv % MOD) %
                MOD +
            MOD) %
           MOD;
    TR += R;
    TRR += R * R;
    TC += C;
    TCC += C * C;
  }
  TR %= MOD;
  TRR %= MOD;
  TC %= MOD;
  TCC %= MOD;
  inc(SE, TE);
  inc(SR, TR);
  inc(SC, TC);
  inc(SRR, TRR);
  inc(SCC, TCC);
  fst = false;
  if (flag == 1) ans = TE;
}
int main() {
  scanf("%d%d", &n, &m);
  int cnt = 0;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < m + 1; j++) {
      scanf("%d", &a[i][j]);
      b[++cnt] = Node{a[i][j], i, j};
    }
  int x, y;
  scanf("%d%d", &x, &y);
  V = a[x][y];
  sort(b + 1, b + 1 + cnt, cmp);
  SE = SR = SC = k = 0;
  for (int i = 1; i < cnt + 1; i++) {
    if (b[i].v == V) break;
    int j = i;
    while (j + 1 <= cnt && b[j + 1].v == b[j].v) j++;
    gao(i, j, -1);
    i = j;
  }
  for (int i = 1; i < cnt + 1; i++) {
    if (b[i].r == x && b[i].c == y) {
      gao(i, i, 1);
      break;
    }
  }
  printf("%I64d\n", ans);
}
