#include <bits/stdc++.h>
using namespace std;
int n, m, q, is[45][45], s[45][45][45][45];
char str[45];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
void work() {
  n = read();
  m = read();
  q = read();
  for (int i = 1; i <= n; i++) {
    scanf("%s", str + 1);
    for (int j = 1; j <= m; j++) {
      is[i][j] = str[j] - '0';
      is[i][j] += is[i - 1][j] + is[i][j - 1] - is[i - 1][j - 1];
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int k = i; k <= n; k++)
        for (int l = j; l <= m; l++)
          if (is[k][l] - is[i - 1][l] - is[k][j - 1] + is[i - 1][j - 1] == 0)
            s[i][j][k][l]++;
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--)
      for (int k = 1; k <= n; k++)
        for (int l = 1; l <= m; l++) s[i][j][k][l] += s[i + 1][j][k][l];
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--)
      for (int k = 1; k <= n; k++)
        for (int l = 1; l <= m; l++) s[i][j][k][l] += s[i][j + 1][k][l];
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--)
      for (int k = 1; k <= n; k++)
        for (int l = 1; l <= m; l++) s[i][j][k][l] += s[i][j][k - 1][l];
  for (int i = n; i >= 1; i--)
    for (int j = m; j >= 1; j--)
      for (int k = 1; k <= n; k++)
        for (int l = 1; l <= m; l++) s[i][j][k][l] += s[i][j][k][l - 1];
  int a, b, c, d;
  while (q-- > 0) {
    a = read();
    b = read();
    c = read();
    d = read();
    cout << s[a][b][c][d] << endl;
  }
}
int main() { return work(), 0; }
