#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int inf = 2e9 + 5;
double PI = 3.14159265358979323846;
int n, m, x, y;
const int N = 1e3 + 5;
char a[N][N];
int h[N];
int dp[3][N][N];
int go(int prev, int i, int len) {
  if (i > m) {
    if (len >= x and len <= y)
      return 0;
    else
      return inf;
  }
  if (dp[prev][i][len] != -1) {
    return dp[prev][i][len];
  }
  int ans = inf;
  if (len < x) {
    int cost = 0;
    if (prev == 1) {
      cost = n - h[i];
    } else {
      cost = h[i];
    }
    ans = min(ans, cost + go(prev, i + 1, len + 1));
  } else if (len >= x and len < y) {
    int cost = 0;
    if (prev == 1) {
      cost = n - h[i];
    } else {
      cost = h[i];
    }
    ans = min(ans, cost + go(prev, i + 1, len + 1));
    cost = 0;
    if (prev == 1) {
      cost = h[i];
    } else {
      cost = n - h[i];
    }
    ans = min(ans, cost + go(3 - prev, i + 1, 1));
  } else if (len == y) {
    int cost = 0;
    if (prev == 1) {
      cost = h[i];
    } else {
      cost = n - h[i];
    }
    ans = min(ans, cost + go(3 - prev, i + 1, 1));
  }
  return dp[prev][i][len] = ans;
}
void solve() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> x >> y;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int j = 1; j <= m; j++) {
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      cnt += (a[i][j] == '#');
    }
    h[j] = cnt;
  }
  int ans = min(go(1, 1, 0), go(2, 1, 0));
  cout << ans << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
