#include <bits/stdc++.h>
using namespace std;
const long double E = 2.71828182845904523536;
const long double pi = acos(-1);
const double eps = 1e-9;
const long long inf = 2 * (1LL << 30);
int dcmp(double x, double y) {
  return fabs(x - y) <= eps ? 0 : x < y ? -1 : 1;
};
string convertostring(long long num) {
  stringstream ss;
  ss << num;
  return ss.str();
}
void PLAY() {
  cout << fixed << setprecision(2);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int N = 1010;
int n, m, x, y;
int col[N];
long long mem[N][3][N];
long long sol(int i, int lastcolor, int wid) {
  if (i == m) {
    if (wid >= x && wid <= y)
      return 0;
    else
      return inf;
  }
  long long &ret = mem[i][lastcolor][wid];
  if (ret != -1) return ret;
  long long p1 = inf, p2 = inf, p3 = inf, p4 = inf, p5 = inf, p6 = inf;
  if (lastcolor == 0) {
    if (wid + 1 <= y) p1 = n - col[i] + sol(i + 1, 0, wid + 1);
    if (wid >= x) p2 = col[i] + sol(i + 1, 1, 1);
  }
  if (lastcolor == 1) {
    if (wid + 1 <= y) p3 = col[i] + sol(i + 1, 1, wid + 1);
    if (wid >= x) p4 = n - col[i] + sol(i + 1, 0, 1);
  }
  if (lastcolor == 2) {
    p5 = n - col[i] + sol(i + 1, 0, wid + 1);
    p6 = col[i] + sol(i + 1, 1, wid + 1);
  }
  return ret = min({p1, p2, p3, p4, p5, p6});
}
int main() {
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == '.') col[j]++;
    }
  }
  memset(mem, -1, sizeof mem);
  cout << sol(0, 2, 0);
}
