#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
int arr[1005];
int inf = 1e8;
int Dp[1005][1005][2];
int solve(int index, int pre, int color) {
  if (pre > y) return inf;
  if (index == m) {
    if (pre < x)
      return inf;
    else
      return 0;
  }
  int &ans = Dp[index][pre][color];
  if (ans != -1) return ans;
  if (!color) {
    if (pre >= x)
      return ans = min(n - arr[index] + solve(index + 1, pre + 1, 0),
                       arr[index] + solve(index + 1, 1, 1));
    else
      return ans = n - arr[index] + solve(index + 1, pre + 1, 0);
  } else {
    if (pre >= x)
      return ans = min(n - arr[index] + solve(index + 1, 1, 0),
                       arr[index] + solve(index + 1, pre + 1, 1));
    else
      return ans = arr[index] + solve(index + 1, pre + 1, 1);
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> x >> y;
  string in[n];
  for (int i = 0; i < n; i++) cin >> in[i];
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      arr[i] += in[j][i] == '.';
    }
  }
  memset(Dp, -1, sizeof(Dp));
  cout << min(solve(0, 0, 0), solve(0, 0, 1));
  return 0;
}
