#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());   long long int myRand(long long int B) { return (unsigned long long)rng() % B; }   const int N = 51;   int vld[N][N][N][N];   int main() {     cin.tie(nullptr);     ios::sync_with_stdio(false);     int h, w, q;     cin >> h >> w >> q;     vector<string> s(h);     for (int i = 0; i < h; i++) {       cin >> s[i];     }     vector<vector<int>> sum(h + 1, vector<int>(w + 1));     for (int i = 0; i < h; i++) {       for (int j = 0; j < w; j++) {         sum[i + 1][j + 1] = (s[i][j] ==  0 );       }     }     for (int i = 0; i < h; i++) {       for (int j = 0; j <= w; j++) {         sum[i + 1][j] += sum[i][j];       }     }     for (int j = 0; j < w; j++) {       for (int i = 0; i <= h; i++) {         sum[i][j + 1] += sum[i][j];       }     }     for (int i = 1; i <= h; i++) {       for (int j = 1; j <= w; j++) {         for (int k = i; k <= h; k++) {           for (int l = j; l <= w; l++) {             if ((l - j + 1) * (k - i + 1) ==                 sum[k][l] - sum[i - 1][l] - sum[k][j - 1] + sum[i - 1][j - 1]) {               vld[i][j][k][l] = 1;             }           }         }       }     }     for (int i = 0; i < h; i++) {       for (int j = 0; j <= w; j++) {         for (int k = 0; k <= h; k++) {           for (int l = 0; l <= w; l++) {             vld[i + 1][j][k][l] += vld[i][j][k][l];           }         }       }     }     for (int i = 0; i <= h; i++) {       for (int j = 0; j < w; j++) {         for (int k = 0; k <= h; k++) {           for (int l = 0; l <= w; l++) {             vld[i][j + 1][k][l] += vld[i][j][k][l];           }         }       }     }     for (int i = 0; i <= h; i++) {       for (int j = 0; j <= w; j++) {         for (int k = 0; k < h; k++) {           for (int l = 0; l <= w; l++) {             vld[i][j][k + 1][l] += vld[i][j][k][l];           }         }       }     }     for (int i = 0; i <= h; i++) {       for (int j = 0; j <= w; j++) {         for (int k = 0; k <= h; k++) {           for (int l = 0; l < w; l++) {             vld[i][j][k][l + 1] += vld[i][j][k][l];           }         }       }     }     while (q--) {       int a, b, c, d;       cin >> a >> b >> c >> d;       printf( %d n , vld[c][d][c][d] - vld[a - 1][d][c][d] - vld[c][b - 1][c][d] +                          vld[a - 1][b - 1][c][d]);     }   }   