#include <bits/stdc++.h>
using namespace std;
int n, m, q;
char c[50][50], a[50][50];
int sum[50][50], cnt[50][50][50][50];
bool isGood(int xa, int ya, int xb, int yb) {
  return sum[xa][ya] - sum[xa][yb] - sum[xb][ya] + sum[xb][yb] == 0;
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> c[i][j];
      a[i][j] = c[i][j] - '0';
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + a[i][j];
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      for (int ii = i + 1; ii <= n; ii++)
        for (int jj = j + 1; jj <= m; jj++)
          cnt[i][j][ii + 1][jj + 1] =
              cnt[i][j][ii + 1][jj] + cnt[i][j][ii][jj + 1] -
              cnt[i][j][ii][jj] + (isGood(i, j, ii, jj) ? 1 : 0);
  int k1, k2, k3, k4;
  for (int i = 0; i < q; i++) {
    scanf("%d%d%d%d", &k1, &k2, &k3, &k4);
    int ans = 0;
    k1--, k2--;
    for (int j = k1; j < k3; j++)
      for (int l = k2; l < k4; l++) {
        ans += cnt[j][l][k3 + 1][k4 + 1];
      }
    printf("%d\n", ans);
  }
  return 0;
}
