#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const long double pi = 3.14159265358979323846;
char Array[1001][1001];
int dp[1003][2];
int white[1003], black[1003];
int main() {
  ios::sync_with_stdio(false);
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; ++i) {
    int temp = 0;
    for (int j = 0; j < m; ++j) {
      cin >> Array[i][j];
      dp[j][0] = dp[j][1] = INF;
    }
    dp[m][0] = dp[m][1] = INF;
  }
  dp[0][0] = dp[0][1] = 0;
  for (int j = 0; j < m; ++j) {
    int temp = 0;
    for (int i = 0; i < n; ++i) {
      if (Array[i][j] == '#') {
        ++temp;
      }
    }
    black[j] = temp;
    white[j] = n - temp;
  }
  for (int i = 0; i < m; ++i) {
    int temp1 = 0, temp2 = 0;
    for (int j = i; j < i + y && j < m; ++j) {
      temp1 += black[j];
      temp2 += white[j];
      if (j >= i + x - 1 && j <= i + y - 1) {
        dp[j + 1][0] = min(dp[j + 1][0], dp[i][1] + temp1);
        dp[j + 1][1] = min(dp[j + 1][1], dp[i][0] + temp2);
      }
    }
  }
  int best = min(best, min(dp[m][0], dp[m][1]));
  cout << best;
  return 0;
}
