func_code_string: #include <bits/stdc++.h>   long long gcd(long long A, long long B) {     return A > B ? gcd(B, A) : A ? gcd(B % A, A) : B;   }   long long lcm(long long A, long long B) { return A / gcd(A, B) * B; }   long long pow(long long A, long long B, long long P) {     if (!B) return 1 % P;     if (B == 1) return A % P;     long long h = pow(A, B / 2, P);     h *= h;     h %= P;     if (B % 2) h *= A;     return h % P;   }   using namespace std;   int n, m, q, i, j, I, J;   int a[41][41];   int sum[41][41];   int res[41][41][41][41];   int all[41][41][41][41];   char ch;   int get(int i, int j, int I, int J) {     return sum[I][J] - sum[i - 1][J] - sum[I][j - 1] + sum[i - 1][j - 1];   }   bool f(int k) {     if (k == 0)       return true;     else       return false;   }   int main() {     cin >> n >> m >> q;     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++) {         cin >> ch;         a[i][j] = ch -  0 ;         sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + a[i][j];       }     for (i = n; i >= 1; i--)       for (j = m; j >= 1; j--)         if (!a[i][j]) {           all[i][j][i][j] = 1;           for (I = i - 1; I >= 1; I--)             all[I][j][i][j] = all[I + 1][j][i][j] + f(get(I, j, i, j));           for (J = j - 1; J >= 1; J--)             all[i][J][i][j] = all[i][J + 1][i][j] + f(get(i, J, i, j));           for (I = i - 1; I >= 1; I--)             for (J = j - 1; J >= 1; J--)               all[I][J][i][j] = all[I][J + 1][i][j] + all[I + 1][J][i][j] -                                 all[I + 1][J + 1][i][j] + f(get(I, J, i, j));         }     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++) {         if (!a[i][j]) res[i][j][i][j] = 1;         for (I = i + 1; I <= n; I++)           res[i][j][I][j] = res[i][j][I - 1][j] + all[i][j][I][j];         for (J = j + 1; J <= m; J++)           res[i][j][i][J] = res[i][j][i][J - 1] + all[i][j][i][J];         for (I = i + 1; I <= n; I++)           for (J = j + 1; J <= m; J++)             res[i][j][I][J] = res[i][j][I][J - 1] + res[i][j][I - 1][J] -                               res[i][j][I - 1][J - 1] + all[i][j][I][J];       }     while (q--) {       cin >> i >> j >> I >> J;       cout << res[i][j][I][J] << endl;     }   }   