#include <bits/stdc++.h>
using namespace std;
int matr[40][40];
int N, M, Q;
int S[40][40][40][40];
int f(int x1, int y1, int x2, int y2) {
  int res = matr[x2][y2];
  if (x1 > 0) res -= matr[x1 - 1][y2];
  if (y1 > 0) res -= matr[x2][y1 - 1];
  if (x1 > 0 && y1 > 0) res += matr[x1 - 1][y1 - 1];
  return res;
}
int main() {
  scanf("%d%d%d", &N, &M, &Q);
  for (int i = 0; i < N; i++) {
    char s[100];
    scanf("%s", s);
    for (int j = 0; j < M; j++) matr[i][j] = s[j] - '0';
  }
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) {
      if (i > 0) matr[i][j] += matr[i - 1][j];
      if (j > 0) matr[i][j] += matr[i][j - 1];
      if (i > 0 && j > 0) matr[i][j] -= matr[i - 1][j - 1];
    }
  memset(S, 0, sizeof(int) * 40 * 40 * 40 * 40);
  for (int i1 = 0; i1 < N; i1++)
    for (int i2 = i1; i2 < N; i2++)
      for (int j1 = 0; j1 < M; j1++)
        for (int j2 = j1; j2 < M; j2++) {
          S[i1][j1][i2][j2] = ((f(i1, j1, i2, j2) == 0) ? 1 : 0);
        }
  for (int i1 = 0; i1 < N; i1++)
    for (int j1 = 0; j1 < M; j1++)
      for (int i2 = i1; i2 < N; i2++)
        for (int j2 = j1; j2 < M; j2++) {
          if (i2 > 0) S[i1][j1][i2][j2] += S[i1][j1][i2 - 1][j2];
          if (j2 > 0) S[i1][j1][i2][j2] += S[i1][j1][i2][j2 - 1];
          if (i2 > 0 && j2 > 0) S[i1][j1][i2][j2] -= S[i1][j1][i2 - 1][j2 - 1];
        }
  for (int i1 = N - 1; i1 >= 0; i1--)
    for (int j1 = M - 1; j1 >= 0; j1--)
      for (int i2 = i1; i2 < N; i2++)
        for (int j2 = j1; j2 < M; j2++) {
          if (i1 + 1 < N) S[i1][j1][i2][j2] += S[i1 + 1][j1][i2][j2];
          if (j1 + 1 < M) S[i1][j1][i2][j2] += S[i1][j1 + 1][i2][j2];
          if (i1 + 1 < N && j1 + 1 < M)
            S[i1][j1][i2][j2] -= S[i1 + 1][j1 + 1][i2][j2];
        }
  for (int i = 0; i < Q; i++) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    x1--;
    y1--;
    x2--;
    y2--;
    printf("%d\n", S[x1][y1][x2][y2]);
  }
  return 0;
}
