#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int arr[m];
  int whites[m];
  for (int i = 0; i < m; i++) arr[i] = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == '.') {
        arr[j]++;
      }
    }
  }
  whites[0] = arr[0];
  for (int i = 1; i < m; i++) whites[i] = whites[i - 1] + arr[i];
  int dp[m][2];
  for (int i = 0; i < m; i++) {
    dp[i][0] = 10000000;
    dp[i][1] = 10000000;
  }
  for (int i = 0; i < m; i++) {
    if (i <= x - 1) {
      dp[i][0] = n * (i + 1) - whites[i];
      dp[i][1] = whites[i];
    } else {
      for (int j = x; i + 1 - j >= 0 and j <= y; j++) {
        if (i + 1 - j < x) {
          dp[i][0] = min(dp[i][0], n * (i + 1) - (whites[i]));
          dp[i][1] = min(dp[i][1], whites[i]);
          break;
        }
        dp[i][0] =
            min(dp[i][0], dp[i - j][1] + n * j - (whites[i] - whites[i - j]));
        dp[i][1] = min(dp[i][1], dp[i - j][0] + whites[i] - whites[i - j]);
      }
    }
  }
  cout << min(dp[m - 1][0], dp[m - 1][1]);
  return 0;
}
