#include <bits/stdc++.h>
using namespace std;
int a[55][55], d[55][55], dd[55][55][55][55], ans[55][55][55][55], i, j,
    k[55][55][55][55], l, m, n;
char c;
int ss(int i, int j, int i1, int j1) {
  return ((d[i1][j1] - d[i1][j - 1] - d[i - 1][j1] + d[i - 1][j - 1]) == 0);
}
int main() {
  int m1;
  cin >> n >> m >> m1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> c, a[i][j] = c - '0';
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      d[i][j] = d[i - 1][j] + d[i][j - 1] - d[i - 1][j - 1] + a[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int i1 = i; i1 >= 1; i1--)
        for (int j1 = j; j1 >= 1; j1--) {
          k[i1][j1][i][j] = ss(i1, j1, i, j) + k[i1][j1 + 1][i][j] +
                            k[i1 + 1][j1][i][j] - k[i1 + 1][j1 + 1][i][j];
        }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int i1 = i; i1 <= n; i1++)
        for (int j1 = j; j1 <= m; j1++) {
          ans[i][j][i1][j1] = ans[i][j][i1 - 1][j1] + ans[i][j][i1][j1 - 1] -
                              ans[i][j][i1 - 1][j1 - 1] + k[i][j][i1][j1];
        }
  while (m1--) {
    int i, j, i1, j1;
    cin >> i >> j >> i1 >> j1;
    cout << ans[i][j][i1][j1] << endl;
  }
}
