#include <bits/stdc++.h>
using namespace std;
int m, n, Q;
char a[123][123];
int s[45][45];
int sum(int x, int y, int xx, int yy) {
  return s[xx][yy] - s[x - 1][yy] - s[xx][y - 1] + s[x - 1][y - 1];
}
struct indexed_tree {
  int T[45][45][45][45];
  void update(int a, int b, int c, int d) {
    for (int i = a; i <= m; i += i & -i)
      for (int j = b; j <= n; j += j & -j)
        for (int k = c; k <= m; k += k & -k)
          for (int l = d; l <= n; l += l & -l) T[i][j][k][l]++;
  }
  long get(int a, int b, int c, int d) {
    int r = 0;
    for (int i = a; i >= 1; i -= i & -i)
      for (int j = b; j >= 1; j -= j & -j)
        for (int k = c; k >= 1; k -= k & -k)
          for (int l = d; l >= 1; l -= l & -l) r += T[i][j][k][l];
    return r;
  }
} tr;
int main() {
  ios::sync_with_stdio(false);
  cin >> m >> n >> Q;
  for (int i = 1; i <= m; i++) cin >> (a[i] + 1);
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++)
      s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] +
                (a[i][j] == '1' ? 1 : 0);
  for (int x = 1; x <= m; x++)
    for (int y = 1; y <= n; y++)
      for (int i = 1; i <= x; i++)
        for (int j = 1; j <= y; j++)
          if (sum(i, j, x, y) == 0) tr.update(m - i + 1, n - j + 1, x, y);
  for (int i = 1; i <= Q; i++) {
    int x, y, xx, yy;
    cin >> x >> y >> xx >> yy;
    cout << tr.get(m - x + 1, n - y + 1, xx, yy) << endl;
  }
  cin.ignore(3);
}
