#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
int black[1000];
int dp[1000][1005][3];
int solve(int col, int last, int width) {
  if (col == m) {
    if (width >= x && width <= y)
      return 0;
    else
      return 1e9;
  }
  int &ans = dp[col][width][last];
  if (ans != -1) return ans;
  int goblack = n - black[col];
  int gowhite = black[col];
  int b = 1e9, w = 1e9;
  if (col == 0 || (last == 0 && width >= x) || (last == 1 && width < y))
    b = goblack + solve(col + 1, 1, (last == 1) ? width + 1 : 1);
  if (col == 0 || (last == 1 && width >= x) || (last == 0 && width < y))
    w = gowhite + solve(col + 1, 0, (last == 0) ? width + 1 : 1);
  return ans = min(b, w);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> x >> y;
  memset(black, 0, sizeof black);
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      if (c == '#') black[j]++;
    }
  printf("%d", solve(0, 2, 0));
}
