#include <bits/stdc++.h>
using namespace std;
template <typename T>
T fastPower(T base, T power) {
  if (!power) return 1;
  T ans = fastPower(base, power / 2);
  return power & 1 ? ans * ans * base : ans * ans;
}
int n, m, x, y;
char grid[1005][1005];
int memo[2][1005];
int black[1005], white[1005];
int dp() {
  for (int i = 0; i < m; ++i) {
    int blackCtr = 0, whiteCtr = 0;
    for (int j = i; j >= 0 and i - j + 1 <= y; --j) {
      blackCtr += black[j], whiteCtr += white[j];
      if (i - j + 1 >= x) {
        if (j) {
          memo[0][i] = min(memo[0][i], memo[1][j - 1] + blackCtr);
          memo[1][i] = min(memo[1][i], memo[0][j - 1] + whiteCtr);
        } else {
          memo[0][i] = min(memo[0][i], blackCtr);
          memo[1][i] = min(memo[1][i], whiteCtr);
        }
      }
    }
  }
  return min(memo[0][m - 1], memo[1][m - 1]);
}
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  memset(memo, 0x3f3f3f3f, sizeof(memo));
  scanf("%d%d%d%d", &n, &m, &x, &y);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cin >> grid[i][j];
  }
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      black[i] += grid[j][i] == '#';
      white[i] += grid[j][i] == '.';
    }
  }
  int ans = dp();
  printf("%d", ans);
  return 0;
}
