#include <bits/stdc++.h>
using namespace std;
const long long OO = 0x3f3f3f3f;
int n, m, x, y;
int mem[1001][1001][2];
int mini(vector<int> &w, int last = 0, int len = 0, int c = 0) {
  int &ret = mem[c][len][last];
  if (ret != -1) return ret;
  if (c == ((int)w.size())) {
    if (len < x || len > y) return OO;
    return ret = 0;
  }
  int minw = OO, minb = OO;
  if (c == 0 || last == 0 && len + 1 <= y || last == 1 && len >= x)
    minw = n - w[c] + mini(w, 0, (last == 0 ? len + 1 : 1), c + 1);
  if (c == 0 || last == 1 && len + 1 <= y || last == 0 && len >= x)
    minb = w[c] + mini(w, 1, (last == 1 ? len + 1 : 1), c + 1);
  return ret = min(minw, minb);
}
int main() {
  (ios_base::sync_with_stdio(false), cin.tie(NULL));
  cin >> n >> m >> x >> y;
  vector<string> sq(n);
  for (int i = 0; i < (int)(n); ++i) cin >> sq[i];
  vector<int> w(m);
  for (int j = 0; j < (int)(m); ++j)
    for (int i = 0; i < (int)(n); ++i) w[j] += (sq[i][j] == '.');
  memset(mem, -1, sizeof(mem));
  cout << mini(w);
  return 0;
}
