#include <bits/stdc++.h>
using namespace std;
int x, y, n, m;
char inp[1005][1005];
int memo[1005][2];
int gowhite[1005], goblack[1005];
int call(int ind, int flag) {
  int i, ret = 1 << 30, sumo = 0, sumi = 0;
  if (ind > m) return 1 << 20;
  if (ind == m) return 0;
  if (memo[ind][flag] > -1) return memo[ind][flag];
  for (i = ind; i < ind + x - 1; i++) {
    sumo += gowhite[i];
    sumi += goblack[i];
  }
  for (i = x - 1; i < y; i++) {
    sumo += gowhite[ind + i];
    sumi += goblack[ind + i];
    if (flag)
      ret = min(ret, call(ind + i + 1, 0) + sumo);
    else
      ret = min(ret, call(ind + i + 1, 1) + sumi);
  }
  return memo[ind][flag] = ret;
}
int main() {
  int i, j, ans, wh, bl;
  cin >> n >> m >> x >> y;
  memset(memo, -1, sizeof memo);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) scanf(" %c", &inp[i][j]);
  for (i = 0; i < m; i++) {
    wh = 0;
    bl = 0;
    for (j = 0; j < n; j++) {
      if (inp[j][i] == '.')
        bl++;
      else
        wh++;
    }
    gowhite[i] = wh;
    goblack[i] = bl;
  }
  ans = min(call(0, 0), call(0, 1));
  cout << ans << endl;
  return 0;
}
