#include <bits/stdc++.h>
using namespace std;
int n, m, q, a[50][50];
int f[50][50], cnt[45][45][45][45];
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      char ch = getchar();
      while (ch != '0' && ch != '1') ch = getchar();
      a[i][j] = (ch == '1');
    }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      if (i == 0 && j == 0)
        f[i][j] = a[i][j];
      else
        f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1] + a[i][j];
    }
  for (int xa = 1; xa <= n; xa++)
    for (int ya = 1; ya <= m; ya++)
      for (int xb = xa; xb <= n; xb++)
        for (int yb = ya; yb <= m; yb++) {
          int sum =
              f[xb][yb] - f[xa - 1][yb] - f[xb][ya - 1] + f[xa - 1][ya - 1];
          if (sum == 0) cnt[xa][ya][xb][yb] = 1;
        }
  for (int xa = n; xa >= 2; xa--)
    for (int ya = 1; ya <= m; ya++)
      for (int xb = xa; xb <= n; xb++)
        for (int yb = ya; yb <= m; yb++)
          cnt[xa - 1][ya][xb][yb] += cnt[xa][ya][xb][yb];
  for (int xa = 1; xa <= n; xa++)
    for (int ya = m; ya >= 2; ya--)
      for (int xb = xa; xb <= n; xb++)
        for (int yb = ya; yb <= m; yb++)
          cnt[xa][ya - 1][xb][yb] += cnt[xa][ya][xb][yb];
  for (int xa = 1; xa <= n; xa++)
    for (int ya = 1; ya <= m; ya++)
      for (int xb = xa; xb <= n; xb++)
        for (int yb = ya; yb <= m; yb++)
          cnt[xa][ya][xb + 1][yb] += cnt[xa][ya][xb][yb];
  for (int xa = 1; xa <= n; xa++)
    for (int ya = 1; ya <= m; ya++)
      for (int xb = xa; xb <= n; xb++)
        for (int yb = ya; yb <= m; yb++)
          cnt[xa][ya][xb][yb + 1] += cnt[xa][ya][xb][yb];
  int k1, k2, k3, k4;
  while (q--) {
    scanf("%d%d%d%d", &k1, &k2, &k3, &k4);
    printf("%d\n", cnt[k1][k2][k3][k4]);
  }
  return 0;
}
