#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
  long long n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<string> v1(n);
  for (long long i = 0; i < n; i++) {
    cin >> v1[i];
  }
  long long black1[m + 1];
  long long white1[m + 1];
  for (long long i = 0; i < m; i++) {
    long long black = 0;
    long long white = 0;
    for (long long j = 0; j < n; j++) {
      if (v1[j][i] == '.')
        white++;
      else
        black++;
    }
    black1[i + 1] = white;
    white1[i + 1] = black;
  }
  black1[0] = 0;
  white1[0] = 0;
  long long dp[m + 1][2];
  dp[0][0] = 0;
  dp[0][1] = 0;
  for (long long i = 1; i <= m; i++) {
    dp[i][0] = 100000000000000007;
    dp[i][1] = 100000000000000007;
  }
  for (long long i = 1; i <= m; i++) {
    black1[i] += black1[i - 1];
    white1[i] += white1[i - 1];
  }
  for (long long i = 1; i <= m; i++) {
    for (long long j = x; j <= y; j++) {
      if (i - j >= 0) {
        dp[i][1] = min(dp[i][1], dp[i - j][0] + white1[i] - white1[i - j]);
        dp[i][0] = min(dp[i][0], (dp[i - j][1]) + black1[i] - black1[i - j]);
      }
    }
  }
  cout << min(dp[m][0], dp[m][1]) << endl;
}
