#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int *a = new int[m];
  int *b = new int[m];
  int *w = new int[m];
  int *minb = new int[m];
  int *minw = new int[m];
  char *s = new char[m + 1];
  for (int i = 0; i < (int)m; i++) a[i] = 0;
  for (int i = 0; i < (int)n; i++) {
    scanf("%s", s);
    for (int i = 0; i < (int)m; i++)
      if (s[i] == '#') a[i]++;
  }
  b[0] = n - a[0];
  w[0] = a[0];
  for (int i = (int)1; i < (int)m; i++) {
    b[i] = b[i - 1] + n - a[i];
    w[i] = w[i - 1] + a[i];
  }
  minb[0] = n - a[0];
  minw[0] = a[0];
  for (int i = (int)1; i < (int)m; i++) {
    minb[i] = (int)1E9;
    minw[i] = (int)1E9;
    for (int j = i - x; j >= i - y && j >= -1; j--) {
      if (((j >= 0) ? b[i] - b[j] + minw[j] : b[i]) < minb[i] &&
          (j == -1 || (j >= 0 && j >= x - 1)))
        minb[i] = ((j >= 0) ? b[i] - b[j] + minw[j] : b[i]);
      if (((j >= 0) ? w[i] - w[j] + minb[j] : w[i]) < minw[i] &&
          (j == -1 || (j >= 0 && j >= x - 1)))
        minw[i] = ((j >= 0) ? w[i] - w[j] + minb[j] : w[i]);
    }
  }
  cout << min(minb[m - 1], minw[m - 1]) << endl;
  return 0;
}
