#include <bits/stdc++.h>
using namespace std;
int S[45][45];
int ans[45][45][45][45], n, m, k;
int Sum(int x, int y, int p, int q) {
  return S[p][q] - S[p][y - 1] - S[x - 1][q] + S[x - 1][y - 1];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> k;
  int u, v, p, q;
  char P;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> P;
      S[i][j] = S[i - 1][j] + S[i][j - 1] - S[i - 1][j - 1] + P - '0';
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int p = i; p <= n; p++)
        for (int q = j; q <= m; q++) {
          ans[i][j][p][q] = ans[i][j][p - 1][q] + ans[i][j][p][q - 1] -
                            ans[i][j][p - 1][q - 1];
          for (int u = i; u <= p; u++)
            for (int v = j; v <= q; v++)
              if (Sum(u, v, p, q) == 0) ans[i][j][p][q]++;
        }
  for (int i = 1; i <= k; i++) {
    cin >> u >> v >> p >> q;
    cout << ans[u][v][p][q] << endl;
  }
}
