#include <bits/stdc++.h>
using namespace std;
void _fill_int(int* p, int val, int rep) {
  int i;
  for (i = 0; i < rep; i++) p[i] = val;
}
signed long long GETi() {
  signed long long i;
  scanf("%lld", &i);
  return i;
}
int H, W, Q;
string S[100];
int num[42][42][42][42];
signed long long snum[42][42][42][42];
signed long long snum2[42][42][42][42];
signed long long res[42][42][42][42];
void solve() {
  int f, i, j, k, l, x, y, xx1, yy1, xx2, yy2;
  cin >> H >> W >> Q;
  for (y = 0; y < H; y++) cin >> S[y];
  for (y = 0; y < H; y++)
    for (x = 0; x < W; x++) {
      int r = 100;
      for (i = 0; i < H - y; i++) {
        for (j = 0; j < min(W - x, r); j++) {
          if (S[y + i][x + j] == '1') break;
          num[y][x][i][j] = 1;
        }
        r = min(r, j);
      }
      for (i = 0; i < H - y; i++) {
        for (j = 0; j < W - x; j++) {
          snum[y][x][i][j] = num[y][x][i][j];
          if (i > 0 && j > 0) {
            snum[y][x][i][j] += snum[y][x][i - 1][j] + snum[y][x][i][j - 1] -
                                snum[y][x][i - 1][j - 1];
          } else if (i > 0)
            snum[y][x][i][j] += snum[y][x][i - 1][j];
          else if (j > 0)
            snum[y][x][i][j] += snum[y][x][i][j - 1];
        }
      }
    }
  for (y = H - 1; y >= 0; y--)
    for (x = W - 1; x >= 0; x--) {
      for (i = 0; i < y + 1; i++)
        for (j = 0; j < x + 1; j++) {
          snum2[y][x][i][j] = snum[y - i][x - j][i][j];
          if (i > 0 && j > 0) {
            snum2[y][x][i][j] += snum2[y][x][i - 1][j] + snum2[y][x][i][j - 1] -
                                 snum2[y][x][i - 1][j - 1];
          } else if (i > 0)
            snum2[y][x][i][j] += snum2[y][x][i - 1][j];
          else if (j > 0)
            snum2[y][x][i][j] += snum2[y][x][i][j - 1];
        }
    }
  for (i = 0; i < Q; i++) {
    cin >> yy1 >> xx1 >> yy2 >> xx2;
    cout << snum2[yy2 - 1][xx2 - 1][yy2 - yy1][xx2 - xx1] << endl;
  }
}
int main(int argc, char** argv) {
  string s;
  for (int i = 1; i < argc; i++) s += argv[i], s += '\n';
  for (int i = s.size() - 1; i >= 0; i--) ungetc(s[i], stdin);
  solve();
  return 0;
}
