#include <bits/stdc++.h>
using namespace std;
char g[1005][1005];
int a[1005], b[1005];
int dp[1005][1005][2];
int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) {
    scanf("%s", g[i] + 1);
    for (int j = 1; j <= m; j++) {
      if (g[i][j] == '.')
        a[j]++;
      else
        b[j]++;
    }
  }
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  dp[1][1][0] = b[1];
  dp[1][1][1] = a[1];
  for (int i = 1; i <= m; i++) {
    for (int j = x; j <= y; j++) {
      dp[i][1][0] = min(dp[i][1][0], dp[i - 1][j][1] + b[i]);
      dp[i][1][1] = min(dp[i][1][1], dp[i - 1][j][0] + a[i]);
    }
    for (int j = 2; j <= y; j++) {
      dp[i][j][0] = dp[i - 1][j - 1][0] + b[i];
      dp[i][j][1] = dp[i - 1][j - 1][1] + a[i];
    }
  }
  int ans = 0x3f3f3f3f;
  for (int i = x; i <= y; i++) {
    ans = min(min(dp[m][i][1], dp[m][i][0]), ans);
  }
  cout << ans << endl;
}
