#include <bits/stdc++.h>
using namespace std;
char st[50][50];
int dp[50][50][50][50], b[50][50][50][50], a[50][50], i, n, m, q, k, l, j, p;
int main() {
  int x, y, x1, y1, i1, j1;
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    cin >> st[i];
    for (j = 0; j < m; j++) a[i + 1][j + 1] = st[i][j] - 48;
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (a[i][j] == 0) {
        dp[i][j][i][j] = 1;
        b[i][j][i][j] = 1;
      }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      for (l = i; l <= n; l++)
        for (k = j; k <= m; k++) {
          p = 0;
          for (i1 = i; i1 <= l; i1++) {
            for (j1 = j; j1 <= k; j1++)
              if (a[i1][j1] == 1) {
                p = 1;
                break;
              }
            if (p == 1) break;
          }
          if (p == 0) b[i][j][l][k] = 1;
        }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      for (l = i; l <= n; l++)
        for (k = j; k <= m; k++) {
          dp[i][j][l][k] =
              dp[i][j][l][k - 1] + dp[i][j][l - 1][k] - dp[i][j][l - 1][k - 1];
          if (a[l][k] == 0) {
            for (i1 = i; i1 <= l; i1++)
              for (j1 = j; j1 <= k; j1++) dp[i][j][l][k] += b[i1][j1][l][k];
          }
        }
    }
  while (q--) {
    cin >> x >> y >> x1 >> y1;
    cout << dp[x][y][x1][y1] << "\n";
  }
  return 0;
}
