#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
const char E = '\n';
const int N = 1005;
ll n, m, x, y, wh[N], dp[2][N], bl[N];
char a[N][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= m; i++) {
    dp[0][i] = dp[1][i] = INT_MAX;
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      if (a[i][j] == '.')
        wh[j]++;
      else
        bl[j]++;
    }
  }
  for (int i = 1; i <= m; i++) {
    wh[i] += wh[i - 1];
    bl[i] += bl[i - 1];
  }
  for (int i = x; i <= m; i++) {
    for (int j = i - y + 1; j <= i - x + 1; j++) {
      if (j <= 0) continue;
      dp[0][i] = min(dp[0][i], dp[1][j - 1] + bl[i] - bl[j - 1]);
      dp[1][i] = min(dp[1][i], dp[0][j - 1] + wh[i] - wh[j - 1]);
    }
  }
  cout << min(dp[0][m], dp[1][m]);
  return 0;
}
