#include <bits/stdc++.h>
using namespace std;
bool isFile = 0;
const long long INF = 1e15 + 1234;
const int N = 4e5 + 1234;
const long long MOD = 998244353;
const long long mod = 1e9 + 7;
double EPS = 3e-18;
const double PI = acos(-1);
void faster() {
  if (isFile) {
    freopen(
        ""
        ".in",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void solve() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<long long> a(m + 1), b(m + 1), c(m + 1);
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 1; j <= m; j++) {
      if (s[j - 1] == '.') c[j]++;
      a[j] = b[j] = INF;
    }
  }
  for (int i = 1; i <= m; i++) c[i] += c[i - 1];
  for (int i = 1; i <= m; i++)
    for (int j = x; j <= y; j++) {
      if (i >= j) {
        a[i] = min(c[i] - c[i - j] + b[i - j], a[i]);
        b[i] = min(j * n - c[i] + c[i - j] + a[i - j], b[i]);
      }
    }
  cout << min(a[m], b[m]);
}
int main() {
  faster();
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
