#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
int b[1005], a[1005];
int F1[1005], F2[1005];
int main() {
  char ch;
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      cin >> ch;
      if (ch == '#') b[j]++;
    }
  for (int i = 1; i <= m; ++i) a[i] = a[i - 1] + b[i];
  for (int i = 1; i <= m; ++i) {
    F1[i] = 10000000;
    F2[i] = 10000000;
  }
  for (int i = x; i <= y; ++i) {
    F1[i] = a[i];
    F2[i] = n * i - a[i];
  }
  for (int i = x + 1; i <= m; ++i) {
    for (int j = x; j <= y; ++j)
      if (i - j >= x) {
        if (F1[i] > F2[i - j] + a[i] - a[i - j])
          F1[i] = F2[i - j] + a[i] - a[i - j];
        if (F2[i] > F1[i - j] + n * j - a[i] + a[i - j])
          F2[i] = F1[i - j] + n * j - a[i] + a[i - j];
      }
  }
  if (F1[m] > F2[m])
    cout << F2[m];
  else
    cout << F1[m];
  return 0;
}
