#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
vector<int> a(1000, 0);
vector<int> s1(1000, -1);
vector<int> s2(1000, -1);
int solution(int position, int previous_type, int previous_length);
int get_s1(int position) {
  if (s1[position] == -1) s1[position] = solution(position, 1, 0);
  return s1[position];
}
int get_s2(int position) {
  if (s2[position] == -1) s2[position] = solution(position, -1, 0);
  return s2[position];
}
int solution(int position, int previous_type, int previous_length) {
  int result;
  if (position == m)
    if (previous_length < x)
      return (m * n);
    else
      return 0;
  if (position == 0) {
    return min(a[0] + solution(1, 1, 1), (n - a[0]) + solution(1, -1, 1));
  }
  if (previous_length < x)
    return (((previous_type == 1) ? a[position] : n - a[position]) +
            solution(position + 1, previous_type, previous_length + 1));
  if (previous_length == y) {
    int v = ((previous_type == 1) ? get_s2(position) : get_s1(position));
    return v;
  }
  return min(((previous_type == 1) ? a[position] : n - a[position]) +
                 solution(position + 1, previous_type, previous_length + 1),
             ((previous_type == 1) ? get_s2(position) : get_s1(position)));
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < m; ++j) {
      if (s[j] == '#') a[j]++;
    }
  }
  cout << solution(0, 1, 0) << endl;
  return 0;
}
