#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long m, n, x, y;
long long util(long long i, long long flag, vector<vector<long long>> &dp,
               vector<vector<long long>> &sum) {
  if (i < 0) return 0;
  if (dp[i][flag] != -1) return dp[i][flag];
  long long mini = 1e9;
  long long j;
  for (j = x; j <= y; j++) {
    long long diff = sum[flag][i];
    if (i - j < -1) continue;
    if (i - j >= 0) diff -= sum[flag][i - j];
    mini = min(mini, util(i - j, !flag, dp, sum) + diff);
  }
  return dp[i][flag] = mini;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i, j, res, k;
  cin >> m >> n >> x >> y;
  char grid[m][n];
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++) cin >> grid[i][j];
  long long col[2][n];
  for (j = 0; j < n; j++) {
    col[0][j] = 0;
    for (i = 0; i < m; i++)
      if (grid[i][j] == '#') col[0][j]++;
  }
  for (i = 0; i < n; i++) col[1][i] = m - col[0][i];
  vector<vector<long long>> dp(n, vector<long long>(2, -1));
  vector<vector<long long>> sum(2, vector<long long>(n, 0));
  sum[0][0] = col[0][0];
  sum[1][0] = col[1][0];
  for (i = 1; i < n; i++) {
    sum[0][i] = sum[0][i - 1] + col[0][i];
    sum[1][i] = sum[1][i - 1] + col[1][i];
  }
  cout << min(util(n - 1, 0, dp, sum), util(n - 1, 1, dp, sum)) << "\n";
}
