#include <bits/stdc++.h>
using namespace std;
const int INF = 1e8;
const int N = 1001;
int n, m, x, y, pref[N], arr[N], dp[N][2];
char c;
int solve(int idx, int t) {
  if (!idx) return dp[idx][t] = 0;
  if (idx < x) return dp[idx][t] = INF;
  int& ret = dp[idx][t];
  if (ret) return dp[idx][t];
  ret = INF;
  for (int i = x; i <= y; i++) {
    if (idx < i) break;
    int col = pref[idx] - pref[idx - i];
    if (t) col = i * n - col;
    ret = min(ret, solve(idx - i, !t) + col);
  }
  return ret;
}
int main() {
  memset(dp, 0, sizeof dp);
  pref[0] = 0;
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> c, arr[j] += (c == '.');
  for (int i = 1; i <= m; i++) pref[i] = pref[i - 1] + arr[i];
  cout << min(solve(m, 0), solve(m, 1));
}
