#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, ans, d[10005], dp[1005][1005][2];
string s[200005];
int main() {
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    s[i] = '#' + s[i];
  }
  for (int i = 1; i <= m; i++) {
    ans = 0;
    for (int j = 1; j <= n; j++) {
      if (s[j][i] == '#') {
        ans++;
      }
    }
    d[i] = ans;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= y; j++) {
      dp[i][j][1] = 1e9 + 7;
      dp[i][j][0] = 1e9 + 7;
    }
  }
  dp[1][1][0] = d[1];
  dp[1][1][1] = n - d[1];
  for (int i = 2; i <= m; i++) {
    for (int j = x; j <= y; j++) {
      if (dp[i - 1][j][0] != 1e9 + 7)
        dp[i][1][0] = min(dp[i - 1][j][1], dp[i][1][0]);
      if (dp[i - 1][j][1] != 1e9 + 7)
        dp[i][1][1] = min(dp[i - 1][j][0], dp[i][1][1]);
    }
    for (int j = 2; j <= y; j++) {
      dp[i][j][0] = dp[i - 1][j - 1][0];
      dp[i][j][1] = dp[i - 1][j - 1][1];
    }
    for (int j = 1; j <= y; j++) {
      if (dp[i][j][0] != 1e9 + 7) {
        dp[i][j][0] += d[i];
      }
      if (dp[i][j][1] != 1e9 + 7) {
        dp[i][j][1] += n - d[i];
      }
    }
  }
  int mix = 1e9;
  for (int i = x; i <= y; i++) {
    if (dp[m][i][1] != 1e9 + 7) mix = min(mix, dp[m][i][1]);
    if (dp[m][i][0] != 1e9 + 7) mix = min(mix, dp[m][i][0]);
  }
  cout << mix << endl;
}
