#include <bits/stdc++.h>
using namespace std;
int moo[41][41][41][41];
char f[41][41];
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; ++i) scanf("%s", f[i]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      for (int ii = i; ii < n; ++ii) {
        bool ok = true;
        for (int jj = j; jj < m; ++jj) {
          for (int kk = i; kk <= ii; ++kk)
            if (f[kk][jj] != '0') {
              ok = false;
              break;
            }
          if (ii > i) moo[i][j][ii][jj] += moo[i][j][ii - 1][jj];
          if (jj > j) moo[i][j][ii][jj] += moo[i][j][ii][jj - 1];
          if (ii > i && jj > j) moo[i][j][ii][jj] -= moo[i][j][ii - 1][jj - 1];
          if (ok) moo[i][j][ii][jj] += 1;
        }
      }
    }
  for (int i = n - 1; i >= 0; --i)
    for (int j = m - 1; j >= 0; --j) {
      for (int ii = i; ii < n; ++ii)
        for (int jj = j; jj < m; ++jj) {
          if (ii > i) moo[i][j][ii][jj] += moo[i + 1][j][ii][jj];
          if (jj > j) moo[i][j][ii][jj] += moo[i][j + 1][ii][jj];
          if (ii > i && jj > j) moo[i][j][ii][jj] -= moo[i + 1][j + 1][ii][jj];
        }
    }
  for (int i = 0; i < q; ++i) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    --a;
    --b;
    --c;
    --d;
    printf("%d\n", moo[a][b][c][d]);
  }
  return 0;
}
