#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3e5 + 10;
const long long INF = 1e18 + 10;
const long long LOG = 1e7 + 19;
const long long MOD = 998244353;
long long pw(long long a, long long b, long long M) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M
                      : pw(a * a % M, b / 2, M)));
}
long long dp[1010][1010], a[1010][1010];
vector<pair<long long, pair<long long, long long> > > vec;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      vec.push_back(make_pair(a[i][j], make_pair(i, j)));
    }
  }
  sort(vec.begin(), vec.end());
  long long r, c;
  cin >> r >> c;
  long long k = n * m, p = 0, x = 0, x2 = 0, y = 0, y2 = 0;
  for (int i = 0; i < k;) {
    int j = i;
    while (j < k && vec[i].first == vec[j].first) {
      j++;
    }
    for (int l = i; l < j; l++) {
      long long s = vec[l].second.first, t = vec[l].second.second;
      dp[s][t] =
          ((p + x2 + i * s * s - 2 * s * x + y2 + i * t * t - 2 * t * y) % MOD +
           MOD) %
          MOD * pw(i, MOD - 2, MOD) % MOD;
    }
    for (int l = i; l < j; l++) {
      long long s = vec[l].second.first, t = vec[l].second.second;
      p = (p + dp[s][t]) % MOD;
      x = (x + s) % MOD;
      x2 = (x2 + s * s) % MOD;
      y = (y + t) % MOD;
      y2 = (y2 + t * t) % MOD;
    }
    i = j;
  }
  cout << dp[r][c];
}
