#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int desll[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int mod = 998244353;
const int maxn = 1e6 + 7;
const int maxm = 1e5 + 7;
const double eps = 1e-8;
int n, k, m;
int ar[maxn];
long long ex_gcd(long long a, long long b, long long &x, long long &y) {
  if (!b) {
    x = 1;
    y = 0;
    return a;
  }
  long long r = ex_gcd(b, a % b, x, y);
  long long t = x % mod;
  x = y % mod;
  y = ((t - a / b * y) % mod + mod) % mod;
  return r;
}
pair<int, pair<int, int>> pa[maxn];
int main() {
  scanf("%d%d", &n, &m);
  int ins = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int x;
      scanf("%d", &x);
      pa[ins++] = make_pair(x, make_pair(i, j));
    }
  }
  int rans, cans;
  scanf("%d%d", &rans, &cans);
  sort(pa, pa + ins);
  int insMid = 0, i = 0;
  long long rr2 = 0, cc2 = 0, r2 = 0, c2 = 0, val = 0;
  long long ans = -1;
  while (i < ins) {
    int j = i;
    long long newrr2 = rr2, newcc2 = cc2, newr2 = r2, newc2 = c2, newval = val;
    while (pa[j].first == pa[i].first) {
      long long r = pa[j].second.first, c = pa[j].second.second;
      long long ansMid = 0;
      ansMid = r * r * i % mod + c * c * i % mod + rr2 + cc2 - r * r2 % mod -
               c * c2 % mod + val;
      ansMid = (ansMid % mod + mod) % mod;
      long long x, y;
      ex_gcd(i, mod, x, y);
      ansMid = ansMid * x % mod;
      if (r == rans && c == cans) {
        ans = ansMid;
        break;
      }
      newrr2 = (newrr2 + r * r % mod) % mod;
      newcc2 = (newcc2 + c * c % mod) % mod;
      newr2 = (newr2 + r * 2) % mod;
      newc2 = (newc2 + c * 2) % mod;
      newval = (newval + ansMid) % mod;
      j++;
    }
    if (ans != -1) break;
    rr2 = newrr2;
    cc2 = newcc2;
    r2 = newr2;
    c2 = newc2;
    val = newval;
    i = j;
  }
  printf("%lld\n", ans);
  return 0;
}
