#include <bits/stdc++.h>
int rows, cols;
int q;
int stx, sty, edx, edy;
int hh;
char A[51][51];
int ans[51][51];
int firow[51][51];
int pri;
int tot;
int keb;
int main() {
  scanf("%d%d%d", &rows, &cols, &q);
  for (int i = 1; i <= rows; i++) {
    scanf("%s", A[i]);
    for (int j = cols; j >= 1; j--) {
      A[i][j] = A[i][j - 1];
    }
  }
  for (int tests = 1; tests <= q; tests++) {
    scanf("%d%d%d%d", &sty, &stx, &edy, &edx);
    pri = 0;
    tot = 0;
    for (int i = stx; i <= edx; i++) {
      ans[sty - 1][i] = 0;
    }
    for (int i = sty; i <= edy; i++) {
      hh = i - sty + 1;
      firow[i][stx - 1] = 0;
      for (int j = stx; j <= edx; j++) {
        firow[i][j] = firow[i][j - 1];
        ans[i][j] = ans[i - 1][j];
        if (A[i][j] == '1') {
          firow[i][j] = j - stx + 1;
        }
        if (firow[i][j] > 0) {
          ans[i][j] = ans[i][j] + firow[i][j];
          keb = 0;
          for (int k = i - 1; k >= sty; k--) {
            if (firow[k][j] > keb) {
              keb = firow[k][j];
            }
            if (keb >= firow[i][j]) {
              break;
            } else {
              ans[i][j] = ans[i][j] + firow[i][j] - keb;
            }
          }
        }
        pri = pri + ans[i][j];
        tot = tot + (hh * (j - stx + 1));
      }
    }
    printf("%d\n", tot - pri);
  }
  return 0;
}
