#include <bits/stdc++.h>
using namespace std;
int INF = 100000000;
int n, m, x, y;
char ch;
long long int pre[2][(int)1e3 + 5], dp[2][(int)1e3 + 5];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> x >> y;
  memset(pre, 0, sizeof(pre));
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> ch;
      if (ch == '.')
        pre[1][j]++;
      else
        pre[0][j]++;
    }
  }
  for (int i = 1; i <= m; i++) {
    pre[0][i] += pre[0][i - 1];
    pre[1][i] += pre[1][i - 1];
  }
  for (int i = 1; i <= m; i++) {
    dp[0][i] = INT_MAX;
    dp[1][i] = INT_MAX;
    for (int j = x; j <= y; j++) {
      if (i - j < 0) {
        break;
      }
      dp[0][i] = min(dp[0][i], dp[1][i - j] + pre[0][i] - pre[0][i - j]);
      dp[1][i] = min(dp[1][i], dp[0][i - j] + pre[1][i] - pre[1][i - j]);
    }
  }
  cout << min(dp[0][m], dp[1][m]) << endl;
  return 0;
}
