#include <bits/stdc++.h>
using namespace std;
int arr[1005][2], pre[1005][2], dp[1004][2];
int main() {
  int n, m, x, y;
  scanf("%d %d %d %d", &n, &m, &x, &y);
  char c;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> c;
      if (c == '#')
        arr[j][0] += 1;
      else
        arr[j][1] += 1;
    }
  }
  for (int i = (1); i <= (m); i++) {
    pre[i][0] = pre[i - 1][0] + arr[i - 1][0];
    pre[i][1] = pre[i - 1][1] + arr[i - 1][1];
    dp[i][0] = 1000000;
    dp[i][1] = 1000000;
  }
  for (int i = 0; i <= m; i++)
    for (int j = x; j <= y; j++) {
      if (i + j <= m) {
        dp[i + j][0] = ((dp[i + j][0] < dp[i][1] + pre[i + j][1] - pre[i][1])
                            ? dp[i + j][0]
                            : dp[i][1] + pre[i + j][1] - pre[i][1]);
        dp[i + j][1] = ((dp[i + j][1] < dp[i][0] + pre[i + j][0] - pre[i][0])
                            ? dp[i + j][1]
                            : dp[i][0] + pre[i + j][0] - pre[i][0]);
      }
    }
  printf("%d\n", ((dp[m][0] < dp[m][1]) ? dp[m][0] : dp[m][1]));
  return 0;
}
