#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int inf = 0x3f3f3f3f;
string s[maxn];
int dp[maxn][10];
int cnt[maxn][10];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) cin >> s[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m - 1; j++) {
      if (s[i][j] == '#')
        cnt[j + 1][0]++;
      else if (s[i][j] == '.')
        cnt[j + 1][1]++;
    }
  }
  for (int i = 2; i <= m; i++) {
    cnt[i][0] += cnt[i - 1][0];
    cnt[i][1] += cnt[i - 1][1];
  }
  memset(dp, inf, sizeof(dp));
  dp[0][0] = dp[0][1] = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = x; j <= min(y, i); j++) {
      dp[i][0] = min(dp[i - j][1] + (cnt[i][0] - cnt[i - j][0]), dp[i][0]);
      dp[i][1] = min(dp[i - j][0] + (cnt[i][1] - cnt[i - j][1]), dp[i][1]);
    }
  }
  cout << min(dp[m][0], dp[m][1]) << endl;
  return 0;
}
