#include <bits/stdc++.h>
using namespace std;
int white[1005];
int black[1005];
int cmwhite[1005];
int cmblack[1005];
int DP[2][1005];
char a[1005][1005];
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; i++) {
    scanf("%s", a[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == '.') {
        white[j + 1]++;
      } else {
        black[j + 1]++;
      }
    }
  }
  cmwhite[1] = white[1];
  cmblack[1] = black[1];
  for (int i = 1; i <= m; i++) {
    cmwhite[i] = white[i] + cmwhite[i - 1];
    cmblack[i] = black[i] + cmblack[i - 1];
  }
  DP[0][0] = 0;
  DP[1][0] = 0;
  int min0;
  int min1;
  for (int i = 1; i <= m; i++) {
    min0 = 10000000;
    min1 = 10000000;
    for (int j = x; j <= y && i - j >= 0; j++) {
      if (i >= j) min0 = min(min0, DP[1][i - j] + cmblack[i] - cmblack[i - j]);
      min1 = min(min1, DP[0][i - j] + cmwhite[i] - cmwhite[i - j]);
    }
    DP[0][i] = min0;
    DP[1][i] = min1;
  }
  cout << min(DP[0][m], DP[1][m]) << endl;
  return 0;
}
