#include <bits/stdc++.h>
using namespace std;
int ans[1002][1002][5];
int calc(vector<int>& col, int x, int y, int n, int i, int j, bool k) {
  if (i >= col.size() && ((j > x && j <= y) || j == 1)) return 0;
  if (i >= col.size()) return INT_MAX - 1000010;
  if (ans[i][j][k] != -1) return ans[i][j][k];
  ans[i][j][k] = 0;
  int cost;
  if (k)
    cost = col[i];
  else
    cost = n - col[i];
  if (j < x)
    ans[i][j][k] = calc(col, x, y, n, i + 1, j + 1, k) + cost;
  else if (j == y)
    ans[i][j][k] = calc(col, x, y, n, i + 1, 1, !k) + cost;
  else
    ans[i][j][k] = min(calc(col, x, y, n, i + 1, j + 1, k) + cost,
                       calc(col, x, y, n, i + 1, 1, !k) + cost);
  return ans[i][j][k];
}
int main() {
  memset(ans, -1, sizeof(ans));
  ;
  int r, c, x, y;
  scanf("%d%d%d%d", &r, &c, &x, &y);
  vector<int> col(c);
  char arr[1005][1005];
  for (int i = 0; i <= r - 1; i++)
    for (int j = 0; j <= c - 1; j++) scanf(" %c", &arr[i][j]);
  int cnt;
  for (int i = 0; i <= c - 1; i++) {
    cnt = 0;
    for (int j = 0; j <= r - 1; j++) {
      if (arr[j][i] == '.') cnt++;
    }
    col[i] = cnt;
  }
  int ans = min(calc(col, x, y, r, 0, 1, 1), calc(col, x, y, r, 0, 1, 0));
  printf("%d\n", ans);
}
