func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = 3.14159265358979323846264338327950288419716939937510;   const double E = 2.7182818284590452353602874713526624977572470936999596;   const double eps = 0.000000001;   const int MOD = 998244353;   inline int max(int u, int v) { return u > v ? u : v; }   inline int min(int u, int v) { return u < v ? u : v; }   inline int gcd(int u, int v) { return v ? gcd(v, u % v) : u; }   template <typename T>   inline void read(T& u) {     char id;     u = 0;     bool flag = 0;     id = getchar();     while (id >  9  || id <  0 ) {       if (id ==  - ) flag = 1;       id = getchar();     }     while ((id <=  9  && id >=  0 )) {       u = u * 10 + id -  0 ;       id = getchar();     }     if (flag) u *= -1;   }   template <typename T>   inline void read(T& u, T& v) {     read(u);     read(v);   }   template <typename T>   inline void read(T& u, T& v, T& tmp) {     read(u);     read(v);     read(tmp);   }   long long n, m, a[1500][1500], r, c, len, f[2250000];   struct node {     long long x, y, v;   } str[2250000];   bool cmp(node x, node y) { return x.v < y.v; }   long long power(long long a, long long n) {     a %= MOD;     long long res = 1;     while (n) {       if (n & 1) res = 1LL * res * a % MOD;       a = 1LL * a * a % MOD;       n >>= 1;     }     return res;   }   long long inv(long long x) { return power(x, MOD - 2) % MOD; }   long long cnt, a1, a2, b1, b2, sum;   void solve(int p) {     f[p] = (sum +             (1LL * str[p].x * str[p].x % MOD * cnt % MOD + a2 -              2LL * str[p].x % MOD * a1 % MOD) +             (1LL * str[p].y * str[p].y % MOD * cnt % MOD + b2 -              2LL * str[p].y % MOD * b1 % MOD)) %            MOD;     f[p] = (1LL * f[p] + MOD) % MOD;     f[p] = 1LL * f[p] * inv(cnt) % MOD;   }   inline void add(int p) {     cnt++;     sum += f[p];     a1 += str[p].x;     a2 += 1LL * str[p].x * str[p].x % MOD;     b1 += str[p].y;     b2 += 1LL * str[p].y * str[p].y % MOD;     a1 %= MOD;     b1 %= MOD;     a2 %= MOD;     b2 %= MOD;     sum %= MOD;   }   int main() {     read(n, m);     for (int i = (1); (i) <= (n); (i)++)       for (int j = (1); (j) <= (m); (j)++) read(a[i][j]);     for (int i = (1); (i) <= (n); (i)++)       for (int j = (1); (j) <= (m); (j)++) str[++len] = (node){i, j, a[i][j]};     sort(str + 1, str + len + 1, cmp);     for (int i = (1); (i) <= (len); (i)++) {       int j;       for (j = i; j <= len; j++)         if (str[j].v != str[i].v) break;       for (int k = (i); (k) <= (j - 1); (k)++) solve(k);       for (int k = (i); (k) <= (j - 1); (k)++) add(k);       i = j - 1;     }     long long r, c;     read(r, c);     long long res = 0;     for (int i = (1); (i) <= (len); (i)++)       if (str[i].x == r && str[i].y == c) res = f[i];     res %= MOD;     res = (res + MOD) % MOD;     cout << res << endl;     return 0;   }   