#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, b[1001], v[1001][2][1001];
char c[1001][1001];
int solve(int cur, int col, int cnt) {
  if (cur == m) return 0;
  int &ret = v[cur][col][cnt];
  if (ret < 1000001) return ret;
  if (cnt >= x) ret = min(ret, solve(cur + 1, 1 - col, 1));
  if (cnt + 1 <= y && m - cur - 1 + cnt >= x)
    ret = min(ret, solve(cur + 1, col, cnt + 1));
  if (col)
    return ret += b[cur];
  else
    return ret += (n - b[cur]);
}
int main() {
  scanf("%d %d %d %d", &n, &m, &x, &y);
  memset(v, 1000001, sizeof(v));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> c[i][j];
      if (c[i][j] == '#') b[j]++;
    }
  }
  printf("%d\n", min(solve(0, 1, 1), solve(0, 0, 1)));
}
