#include <bits/stdc++.h>
using namespace std;
const int c1e5 = 100011;
int n, m, x, y;
int dp[1011][1011][2];
vector<int> coulmn;
int cal(int col, int xx, int st) {
  int& dp2 = dp[col][xx][st];
  if (dp2 != -1) return dp2;
  int step;
  if (st == 0)
    step = coulmn[col];
  else
    step = n - coulmn[col];
  if (col == m - 1) {
    if (xx >= x && y >= xx)
      return step;
    else
      return 2e9;
  }
  int ans = 2e9;
  if (xx >= x) ans = min(ans, cal(col + 1, 1, !st));
  if (xx + 1 <= y) ans = min(ans, cal(col + 1, xx + 1, st));
  return dp2 = ans + step;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n >> m >> x >> y;
  coulmn.resize(m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      char x;
      scanf(" %c", &x);
      if (x == '#') coulmn[j]++;
    }
  cout << min(cal(0, 1, 0), cal(0, 1, 1));
  return 0;
}
