func_code_string: #include <bits/stdc++.h>   using namespace std;   long long arr[3005][3005];   long long zkw[3005 << 2], M;   inline long long query(long long l, long long r) {     long long ret = 1234567891;     for (l += M - 1, r += M + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {       if (~l & 1) ret = min(ret, zkw[l ^ 1]);       if (r & 1) ret = min(ret, zkw[r ^ 1]);     }     return ret;   }   long long brr[3005][3005];   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     long long n, m, a, b;     cin >> n >> m >> a >> b;     long long x, y, z;     cin >> arr[1][1] >> x >> y >> z;     long long px, py;     for (long long i = 1; i <= n; i++)       for (long long j = 1; j <= m; j++) {         if (i != 1 || j != 1) arr[i][j] = (arr[px][py] * x + y) % z;         px = i, py = j;       }     for (M = 1; M - 2 < n; M <<= 1)       ;     for (long long j = 1; j <= m; j++) {       for (long long i = 1; i <= n; i++) zkw[i + M] = arr[i][j];       for (long long i = M - 1; i; i--)         zkw[i] = min(zkw[i << 1], zkw[i << 1 | 1]);       for (long long i = 1; i + a - 1 <= n; i++) brr[i][j] = query(i, i + a - 1);     }     long long ans = 0;     for (M = 1; M - 2 < m; M <<= 1)       ;     for (long long i = 1; i + a - 1 <= n; i++) {       for (long long j = 1; j <= m; j++) zkw[j + M] = brr[i][j];       for (long long j = M - 1; j; j--)         zkw[j] = min(zkw[j << 1], zkw[j << 1 | 1]);       for (long long r = b; r <= m; r++) {         long long l = r - b + 1;         ans += query(l, r);       }     }     cout << ans << endl;     return 0;   }   