#include <bits/stdc++.h>
using namespace std;
long n, m, x, y, i, j, cnt1, cnt2;
long sum[2000][9], dp[2000][9];
char a[2000][2000];
int main() {
  cin >> n >> m >> x >> y;
  for (i = 0; i < n; i++) cin >> a[i];
  sum[0][0] = sum[0][1] = 0;
  for (j = 0; j < m; j++) {
    cnt1 = 0, cnt2 = 0;
    for (i = 0; i < n; i++)
      if (a[i][j] == '.')
        cnt1++;
      else
        cnt2++;
    sum[j + 1][0] = sum[j][0] + cnt1;
    sum[j + 1][1] = sum[j][1] + cnt2;
  }
  for (i = 1; i <= m; i++) dp[i][0] = dp[i][1] = 1000000007;
  dp[0][0] = dp[0][1] = 0;
  for (i = 1; i <= m; i++)
    for (j = max(i - y, 0L); j <= i - x; j++)
      dp[i][0] = min(dp[j][1] + sum[i][1] - sum[j][1], dp[i][0]),
      dp[i][1] = min(dp[j][0] + sum[i][0] - sum[j][0], dp[i][1]);
  cout << min(dp[m][0], dp[m][1]) << endl;
}
