#include <bits/stdc++.h>
using namespace std;
inline void INP() {}
const long long int inf = 0x3f3f3f3f;
const long long int INF = 0x3f3f3f3f3f3f3f3f;
long long int n, m, k, q, x, y, total;
string s;
long long int preDot[(long long int)1e3 + 5], preHash[(long long int)1e3 + 5],
    dp[2][(long long int)1e3 + 5], Dot[(long long int)1e3 + 5];
void go() {
  cin >> n >> m >> x >> y;
  long long int dot = 1, hsh = 0;
  for (long long int i = 1; i < n + 1; i++) {
    for (long long int j = 1; j < m + 1; j++) {
      char ch;
      cin >> ch;
      if (ch == '.') Dot[j]++;
    }
  }
  for (long long int j = 1; j < m + 1; j++) {
    preDot[j] = preDot[j - 1] + Dot[j];
    preHash[j] = preHash[j - 1] + n - Dot[j];
  }
  for (long long int i = 1; i < m + 1; i++) dp[dot][i] = inf, dp[hsh][i] = inf;
  dp[dot][0] = dp[hsh][0] = 0;
  for (long long int j = 1; j < m + 1; j++) {
    for (long long int i = x; i <= y and i <= j; i++) {
      dp[dot][j] = min(dp[dot][j], dp[hsh][j - i] + preDot[j] - preDot[j - i]);
      dp[hsh][j] =
          min(dp[hsh][j], dp[dot][j - i] + preHash[j] - preHash[j - i]);
    }
  }
  long long int ans = min(dp[dot][m], dp[hsh][m]);
  cout << ans << '\n';
}
int32_t main() {
  INP();
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t = 1;
  while (t--) go();
}
