#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const double EPS = 1e-6;
const long long MOD = (long long)(2e9 + 99);
const long long MAXV = (long long)(3e5 + 10);
const long long MAXE = (long long)(1e3 + 10);
int m, n, q;
char tab[505][505];
long long dp_horizontal[505][505];
long long dp_vertical[505][505];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  scanf("%d%d%d", &m, &n, &q);
  for (int i = 1; i <= m; i++) scanf("%s", tab[i] + 1);
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      dp_horizontal[i][j] = dp_horizontal[i][j - 1];
      if (tab[i][j] == '.' && tab[i][j - 1] == '.') dp_horizontal[i][j]++;
    }
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) dp_horizontal[i][j] += dp_horizontal[i - 1][j];
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      dp_vertical[i][j] = dp_vertical[i - 1][j];
      if (tab[i][j] == '.' && tab[i - 1][j] == '.') dp_vertical[i][j]++;
    }
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) dp_vertical[i][j] += dp_vertical[i][j - 1];
  scanf("%d", &q);
  while (q--) {
    int a, b, aa, bb;
    scanf("%d%d%d%d", &a, &b, &aa, &bb);
    long long h, v;
    h = (dp_horizontal[aa][bb] - dp_horizontal[a - 1][bb]) -
        (dp_horizontal[aa][b] - dp_horizontal[a - 1][b]);
    v = (dp_vertical[aa][bb] - dp_vertical[aa][b - 1]) -
        (dp_vertical[a][bb] - dp_vertical[a][b - 1]);
    printf("%lld\n", h + v);
  }
}
