func_code_string: #include <bits/stdc++.h>   using namespace std;   long long ppow(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % 998244353;       a = (a * a) % 998244353;       b >>= 1;     }     return res;   }   struct st {     long long c, x, y;   };   long long sum[2000000];   long long x_2[2000000];   long long xx[2000000];   long long y_2[2000000];   long long yy[2000000];   long long ans[2000000];   signed main() {     int n, m;     scanf( %d%d , &n, &m);     vector<st> v;     for (int i = 0; i < (n); i++)       for (int j = 0; j < (m); j++) {         int a;         scanf( %d , &a);         v.push_back({a, i, j});       }     int r, c;     scanf( %d%d , &r, &c);     r--;     c--;     sort(v.begin(), v.end(), [](st a, st b) { return a.c < b.c; });     for (int i = 0; i < (v.size()); i++) {       st a = v[i];       int j = lower_bound(v.begin(), v.end(), v[i],                           [](st a, st b) { return a.c < b.c; }) -               v.begin();       if (j == 0) {         ans[i] = 0;       } else {         j--;         ans[i] = (sum[j] + x_2[j] * a.x + xx[j] + (a.x * a.x) * (j + 1) +                   y_2[j] * a.y + yy[j] + (a.y * a.y) * (j + 1)) %                  998244353 * ppow(j + 1, 998244353 - 2) % 998244353;       }       sum[i] = ans[i];       x_2[i] = (-2 * a.x + 998244353) % 998244353;       xx[i] = a.x * a.x;       y_2[i] = (-2 * a.y + 998244353) % 998244353;       yy[i] = a.y * a.y;       if (i) {         (sum[i] += sum[i - 1]) %= 998244353;         (x_2[i] += x_2[i - 1]) %= 998244353;         (xx[i] += xx[i - 1]) %= 998244353;         (y_2[i] += y_2[i - 1]) %= 998244353;         (yy[i] += yy[i - 1]) %= 998244353;       }       if (a.x == r && a.y == c) {         cout << ans[i] % 998244353 << endl;         return 0;       }     }   }   