func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = 1e18;   const long long mod = 1e9 + 7;   unsigned long long power(long long x, unsigned long long y, long long p) {     long long res = 1;     x = x % p;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   bool isPrime(long long n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (long long i = 5; i * i <= n; i = i + 6)       if (n % i == 0 || n % (i + 2) == 0) return false;     return true;   }   const long long maxn = 3000 * 3000;   long long g[maxn];   deque<pair<long long, long long>> d;   long long mat[3001][3001];   long long mn[3001][3001];   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long n, m, a, b, x, y, z;     cin >> n >> m >> a >> b;     cin >> g[0] >> x >> y >> z;     for (long long i = 1; i < n * m + 1; i++) {       g[i] = (g[i - 1] * x + y) % z;     }     for (long long i = 1; i < n + 1; i++) {       for (long long j = 1; j < m + 1; j++) {         mat[i][j] = g[(i - 1) * m + j - 1];       }     }     for (long long i = 1; i < n + 1; i++) {       d.clear();       for (long long j = 1; j < m + 1; j++) {         while (d.size() && d.back().first > mat[i][j]) {           d.pop_back();         }         d.push_back({mat[i][j], j});         if (j >= b) {           mn[i][j] = d.front().first;           if (j - d.front().second >= b - 1) {             d.pop_front();           }         }       }     }     d.clear();     for (long long j = b; j < m + 1; j++) {       d.clear();       for (long long i = 1; i < n + 1; i++) {         while (d.size() && d.back().first > mn[i][j]) {           d.pop_back();         }         d.push_back({mn[i][j], i});         if (i >= a) {           mat[i][j] = d.front().first;           if (i - d.front().second >= a - 1) {             d.pop_front();           }         }       }     }     long long ans = 0;     for (long long i = a; i < n + 1; i++) {       for (long long j = b; j < m + 1; j++) {         ans += mat[i][j];       }     }     cout << ans <<   n ;   }   