#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;
template<typename T>
struct Imos2D {
vector<vector<T>> imos;
Imos2D(int h = 0, int w = 0) : imos(h + 2, vector<T>(w + 2)) { }
void add(int i, int j, T x) { imos[i + 1][j + 1] += x; }
void add_rect(int i1, int j1, int i2, int j2, T x = 1) {
add(i1, j1, +x); add(i1, j2, -x); add(i2, j1, -x); add(i2, j2, +x);
}
void build() {
int H = imos.size(), W = imos[0].size();
for (int i = 1; i < H; i++) for (int j = 1; j < W; j++) {
imos[i][j] += imos[i][j - 1] + imos[i - 1][j] - imos[i - 1][j - 1];
}
}
T get(int i, int j) { return imos[i + 1][j + 1]; }
T diff(int si, int sj, int ti, int tj) { // [si, ti) x [sj, tj)
return imos[ti][tj] - imos[ti][sj] - imos[si][tj] + imos[si][sj];
}
};
int main() {
long long h, w; cin >> h >> w;
long long n, m; cin >> n >> m;
vector<string> hanko(n);
for (auto &s: hanko) cin >> s;
int sz_h = min(h, n * 2), sz_w = min(w, m * 2);
Imos2D<int> imos(sz_h, sz_w);
for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
if (hanko[i][j] != '#') continue;
int i2 = i + (sz_h - n) + 1, j2 = j + (sz_w - m) + 1;
imos.add_rect(i, j, i2, j2);
}
imos.build();
long long ans = 0;
for (int i = 0; i < sz_h; i++) for (int j = 0; j < sz_w; j++) {
if (imos.get(i, j)) ans++;
}
int top = INF, bottom = INF, left = INF, right = INF;
for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
if (hanko[i][j] != '#') continue;
top = min<int>(top, i);
bottom = min<int>(bottom, n - 1 - i);
left = min<int>(left, j);
right = min<int>(right, m - 1 - j);
}
if (top != INF) {
ans += (h - sz_h) * (w - left - right);
ans += (w - sz_w) * (h - top - bottom);
ans -= (h - sz_h) * (w - sz_w);
}
cout << ans << endl;
return 0;
}