#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long long inf = 10000000;   inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }   inline bool isLeapYear(long long year) {     return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);   }   inline void normal(long long &a) {     a %= MOD;     (a < 0) && (a += MOD);   }   inline long long modMul(long long a, long long b) {     a %= MOD, b %= MOD;     normal(a), normal(b);     return (a * b) % MOD;   }   inline long long modAdd(long long a, long long b) {     a %= MOD, b %= MOD;     normal(a), normal(b);     return (a + b) % MOD;   }   inline long long modSub(long long a, long long b) {     a %= MOD, b %= MOD;     normal(a), normal(b);     a -= b;     normal(a);     return a;   }   inline long long modPow(long long b, long long p) {     long long r = 1;     while (p) {       if (p & 1) r = modMul(r, b);       b = modMul(b, b);       p >>= 1;     }     return r;   }   inline long long modInverse(long long a) { return modPow(a, MOD - 2); }   inline long long modDiv(long long a, long long b) {     return modMul(a, modInverse(b));   }   inline bool checkBit(long long n, int i) { return n & (1LL << i); }   inline long long setBit(long long n, int i) {     return n | (1LL << i);     ;   }   inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }   int dx[] = {0, 0, 1, -1};   int dy[] = {1, -1, 0, 0};   void input(long long n, const long long a[], int co = 0) {     long long i = 1;     for (; i <= n; i++) {     }   }   const int N = 45;   int dp[N][N][N][N];   char Grid[N][N];   int cal[N][N];   int n, m, k;   void dfs() {}   bool cmp() {}   void gen() {     for (int i = int(1); i < int(n + 1); ++i)       for (int j = int(1); j < int(m + 1); ++j) {         cal[i][j] = cal[i - 1][j] + cal[i][j - 1] - cal[i - 1][j - 1] +                     (Grid[i][j] ==  1 );       }   }   void marmarkatkat() {     for (int i = int(1); i < int(n + 1); ++i) {       for (int j = int(1); j < int(m + 1); ++j) {         for (int l = int(i); l < int(n + 1); ++l)           for (int r = int(j); r < int(m + 1); ++r)             dp[i][j][l][r] += (cal[l][r] + cal[i - 1][j - 1] - cal[i - 1][r] -                                cal[l][j - 1]) == 0;       }     }   }   int main() {     scanf( %d %d %d , &n, &m, &k);     memset(cal, 0, sizeof cal);     ;     for (int i = int(1); i < int(n + 1); ++i) {       scanf( %s , Grid[i] + 1);     }     gen();     marmarkatkat();     for (int l = int(1); l < int(n + 1); ++l) {       for (int r = int(1); r < int(m + 1); ++r) {         for (int i = int(n); i >= int(1); --i)           for (int j = int(m); j >= int(1); --j) {             dp[i][j][l][r] += (dp[i + 1][j][l][r] + dp[i][j + 1][l][r] -                                dp[i + 1][j + 1][l][r]);           }       }     }     for (int l = int(1); l < int(n + 1); ++l) {       for (int r = int(1); r < int(m + 1); ++r) {         for (int i = int(n); i >= int(1); --i)           for (int j = int(m); j >= int(1); --j) {             dp[i][j][l][r] +=                 dp[i][j][l - 1][r] + dp[i][j][l][r - 1] - dp[i][j][l - 1][r - 1];           }       }     }     int a, b, x, y;     for (int i = int(0); i < int(k); ++i) {       scanf( %d %d , &a, &b), scanf( %d %d , &x, &y);       ;       printf( %d n , dp[a][b][x][y]);     }   }