#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<vector<char>> v(n + 1, vector<char>(m + 1));
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> v[i][j];
  vector<int> pre0(m + 1), pre1(m + 1);
  vector<vector<int>> dp(m + 1, vector<int>(2, 100000000));
  dp[0][0] = dp[0][1] = 0;
  for (int j = 1; j <= m; ++j) {
    for (int i = 1; i <= n; ++i)
      if (v[i][j] == '#') ++pre1[j];
    pre0[j] = n - pre1[j];
    pre1[j] += pre1[j - 1];
    pre0[j] += pre0[j - 1];
  }
  for (int i = 1; i <= m; ++i) {
    for (int j = i - y; j <= i - x; ++j) {
      if (j < 0) continue;
      dp[i][0] = min(dp[i][0], dp[j][1] + pre0[i] - pre0[j]);
      dp[i][1] = min(dp[i][1], dp[j][0] + pre1[i] - pre1[j]);
    }
  }
  cout << min(dp[m][0], dp[m][1]);
}
