#include <bits/stdc++.h>
using namespace std;
bool isprime(long long int n) {
  if (n < 2) return false;
  for (long long int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
long long gcd(long long int a, long long int b) {
  if (a == 0 || b == 0)
    return a + b;
  else
    return gcd(b, a % b);
}
const int mx = 100000;
long long int b[mx], w[mx], dp[10][mx];
char c[1100][1100];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (long long int i = 1; i <= n; i++)
    for (long long int j = 1; j <= m; j++) cin >> c[i][j];
  for (long long int i = 1; i <= m; i++) {
    long long int wt = 0, bl = 0;
    for (long long int j = 1; j <= n; j++) {
      if (c[j][i] == '.')
        wt++;
      else
        bl++;
    }
    w[i] = w[i - 1] + wt;
    b[i] = b[i - 1] + bl;
  }
  for (long long int i = 1; i <= m; i++) {
    dp[1][i] = 100000000;
    dp[0][i] = 100000000;
    for (long long int a = x; a <= y; a++) {
      if (i - a >= 0) {
        dp[1][i] = min(dp[0][i - a] + w[i] - w[i - a], dp[1][i]);
        dp[0][i] = min(dp[1][i - a] + b[i] - b[i - a], dp[0][i]);
      }
    }
  }
  cout << min(dp[0][m], dp[1][m]);
  return 0;
}
