#include <bits/stdc++.h>
using namespace std;
int n, m, q;
char a[int(42)][int(42)];
int f[int(42)][int(42)][int(42)][int(42)];
bool t[int(42)][int(42)][int(42)][int(42)];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = (1), _b = (n); i <= _b; i++) scanf("%s", a[i] + 1);
  memset(t, true, sizeof(t));
  for (int x1 = (1), _b = (n); x1 <= _b; x1++)
    for (int y1 = (1), _b = (m); y1 <= _b; y1++) {
      for (int x2 = (x1), _b = (n); x2 <= _b; x2++)
        for (int y2 = (y1), _b = (m); y2 <= _b; y2++) {
          if (x1 == x2 && y1 == y2) {
            if (a[x2][y2] == '1') {
              t[x1][y1][x2][y2] = false;
            }
          } else {
            if (a[x2][y2] == '1' || t[x1][y1][x2 - 1][y2] == false ||
                t[x1][y1][x2][y2 - 1] == false)
              t[x1][y1][x2][y2] = false;
          }
        }
    }
  for (int x2 = (1), _b = (n); x2 <= _b; x2++)
    for (int y2 = (1), _b = (m); y2 <= _b; y2++) {
      for (int x1 = (x2), _a = (1); x1 >= _a; x1--)
        for (int y1 = (y2), _a = (1); y1 >= _a; y1--) {
          f[x1][y1][x2][y2] += f[x1 + 1][y1][x2][y2] + f[x1][y1 + 1][x2][y2] -
                               f[x1 + 1][y1 + 1][x2][y2];
          if (t[x1][y1][x2][y2]) f[x1][y1][x2][y2]++;
        }
    }
  for (int x1 = (1), _b = (n); x1 <= _b; x1++)
    for (int y1 = (1), _b = (m); y1 <= _b; y1++) {
      for (int x2 = (x1), _b = (n); x2 <= _b; x2++)
        for (int y2 = (y1), _b = (m); y2 <= _b; y2++) {
          f[x1][y1][x2][y2] += f[x1][y1][x2 - 1][y2] + f[x1][y1][x2][y2 - 1] -
                               f[x1][y1][x2 - 1][y2 - 1];
        }
    }
  for (int i = (1), _b = (q); i <= _b; i++) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    printf("%d\n", f[x1][y1][x2][y2]);
  }
}
