#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, A[1003][1003][2], c[1003], a, b;
char M[1001][1001];
int f(int idx, int last, int st) {
  if (idx == m + 1) {
    if (last == idx)
      return 0;
    else
      return 1000000007;
  }
  int cn = idx - last + 1;
  if (cn > y) return 1000000007;
  int &ret = A[idx][last][st];
  int s = (st == 0) ? c[idx] : (n - c[idx]);
  if (ret == -1) {
    if (cn >= x)
      ret = min(f(idx + 1, last, st), f(idx + 1, idx + 1, 1 - st)) + s;
    else
      ret = f(idx + 1, last, st) + s;
  }
  return ret;
}
int main() {
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> M[i][j];
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (M[j][i] == '#') c[i]++;
    }
  }
  memset(A, -1, sizeof A);
  cout << min(f(1, 1, 0), f(1, 1, 1)) << '\n';
}
