#include <bits/stdc++.h>
using namespace std;
void print_vector(vector<int> &x);
void print_matrix(vector<vector<int>> &matrix);
int main()
{
int n, q;
cin >> n >> q;
vector<vector<int>> forest(n, vector<int>(n, 0));
for (int i = 0; i < n; i++)
{
char line[n];
cin >> line;
for (int j = 0; j < n; j++)
{
if (line[j] == '*')
{
forest[i][j] = 1;
}
}
}
vector<vector<int>> prefix_sum(n, vector<int>(n, 0));
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
int upper_value = i > 0 ? prefix_sum[i - 1][j] : 0;
int left_value = j > 0 ? prefix_sum[i][j - 1] : 0;
int diagional_value = i > 0 && j > 0 ? prefix_sum[i - 1][j - 1] : 0;
prefix_sum[i][j] = upper_value + left_value - diagional_value + (int)forest[i][j];
}
}
// print_matrix(prefix_sum);
for (int i = 0; i < q; i++)
{
int y1, x1, y2, x2;
cin >> y1 >> x1 >> y2 >> x2;
int sum_a = y1 > 1 && x1 > 1 ? prefix_sum[y1 - 2][x1 - 2] : 0;
int sum_b = y1 > 1 ? prefix_sum[y1 - 2][x2 - 1] : 0;
int sum_c = x1 > 1 ? prefix_sum[y2 - 1][x1 - 2] : 0;
int sum_d = prefix_sum[y2 - 1][x2 - 1];
// cout << "A: " << sum_a << " B: " << sum_b << " c: " << sum_c << " D: " << sum_d << "\n";
cout << sum_d - sum_b - sum_c + sum_a << "\n";
}
}
void print_vector(vector<int> &x)
{
for (int v : x)
{
cout << v << " ";
}
cout << "\n";
}
void print_matrix(vector<vector<int>> &matrix)
{
cout << "\n"
<< "----------------" << "\n";
for (vector<int> row : matrix)
{
print_vector(row);
}
cout << "\n"
<< "----------------" << "\n";
}