#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
}
long long n, m, x, y;
vector<long long> freqCol;
long long cost(long long idx, bool b) {
  return (b ? freqCol[idx] : n - freqCol[idx]);
}
long long mem[1001][1001][2];
long long solve(long long idx, long long cnt, bool b) {
  if (cnt > y) return INT_MAX;
  if (idx == m) return (x > cnt) * INT_MAX;
  long long& ret = mem[idx][cnt][b];
  if (~ret) return ret;
  ret = INT_MAX;
  if (cnt < y) ret = cost(idx, b) + solve(idx + 1, cnt + 1, b);
  if (cnt >= x) ret = min(ret, cost(idx, !b) + solve(idx + 1, 1, !b));
  return ret;
}
int main() {
  fast();
  cin >> n >> m >> x >> y;
  memset(mem, -1, sizeof mem);
  freqCol.resize(m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char x;
      cin >> x;
      freqCol[j] += (x == '#');
    }
  }
  cout << min(solve(0, 0, 0), solve(0, 0, 1)) << "\n";
}
