func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2010;   int n, m, k;   long long sum[maxn][maxn];   char s[maxn][maxn];   long long calc(int x, int y) {     if (x <= 0 || y <= 0) return 0;     long long ans = 0;     int a = x % n, b = y % m;     ans = (1ll * x * y - 1ll * a * b) / 2;     if ((__builtin_popcount(x / n) ^ __builtin_popcount(y / m)) % 2 == 0)       ans += sum[a][b];     else       ans += 1ll * a * b - sum[a][b];     return ans;   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= n; i++) scanf( %s , s[i] + 1);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         int now = s[i][j] -  0 ;         sum[i][j] = now;         sum[i][j + m] = now ^ 1;         sum[i + n][j] = now ^ 1;         sum[i + n][j + m] = now;       }     n <<= 1;     m <<= 1;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];     while (k--) {       int x1, y1, x2, y2;       scanf( %d%d%d%d , &x1, &y1, &x2, &y2);       printf( %lld n , calc(x2, y2) - calc(x2, y1 - 1) - calc(x1 - 1, y2) +                            calc(x1 - 1, y1 - 1));     }     return 0;   }   