#include <bits/stdc++.h>
using namespace std;
template <class T>
void DBGpair(T a, string s = "") {
  cerr << s << (s == "" ? "" : ": ") << a.first << ", " << a.second << "\n";
}
template <class T>
void DBGvec(vector<T> a) {
  for (T i : a) cerr << i << " ";
  cerr << "\n";
}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
char dir[] = {'R', 'L', 'D', 'U'};
const int MOD = 1e9 + 7;
const long long INF = 1e9;
void setIO(string filename) {
  if (fopen((filename + ".in").c_str(), "r")) {
    freopen((filename + ".in").c_str(), "r", stdin);
    freopen((filename + ".out").c_str(), "w", stdout);
  }
}
void solve() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<vector<int>> grid(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char x;
      cin >> x;
      if (x == '#')
        grid[i][j] = 1;
      else
        grid[i][j] = 0;
    }
  }
  vector<int> pre0(m + 1), pre1(m + 1);
  for (int i = 0; i < m; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) cnt += grid[j][i];
    pre1[i + 1] = pre1[i] + cnt;
    pre0[i + 1] = pre0[i] + n - cnt;
  }
  vector<vector<int>> dp(m + 1, vector<int>(2, 1e9));
  dp[0][0] = 0;
  dp[0][1] = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = x; j <= y; j++) {
      if (i - j >= 0) {
        int p0 = dp[i - j][1], p1 = dp[i - j][0];
        p0 += pre0[i] - pre0[i - j];
        p1 += pre1[i] - pre1[i - j];
        dp[i][0] = min(dp[i][0], p0);
        dp[i][1] = min(dp[i][1], p1);
      }
    }
  }
  cout << min(dp[m][0], dp[m][1]) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) solve();
}
