#include <bits/stdc++.h>   using namespace std;   bool check[41][41];   int above[41][41];   int dp[41][41][41][41];   int main() {     int n, m, q, s1, s2, s3, s4;     char s[42];     scanf( %d %d %d , &n, &m, &q);     for (int i = 1; i <= n; i++) {       scanf( %s , s + 1);       for (int j = 1; j <= m; j++)         if (s[j] ==  0 ) check[i][j] = 1, above[i][j] = above[i - 1][j] + 1;     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         for (int k = i; k <= n; k++)           for (int l = j; l <= m; l++) {             dp[i][j][k][l] =                 dp[i][j][k - 1][l] + dp[i][j][k][l - 1] - dp[i][j][k - 1][l - 1];             int temp = min(k - i + 1, above[k][l]);             for (int p = l; p >= j; p--) {               temp = min(temp, above[k][p]);               if (temp == 0)                 break;               else                 dp[i][j][k][l] += temp;             }           }     for (int i = 0; i < q; i++)       scanf( %d %d %d %d , &s1, &s2, &s3, &s4),           printf( %d n , dp[s1][s2][s3][s4]);     return 0;   }   