#include <bits/stdc++.h>
using namespace std;
long long int n, m, x, y, dp[1005][2][1005], cost[1005];
long long int f(long long int cur, long long int pre, long long int cnt) {
  if (dp[cur][pre][cnt] != -1)
    return dp[cur][pre][cnt];
  else if (cur == m) {
    if (cnt >= x && cnt <= y)
      return 0;
    else
      return 1000000007;
  } else if (cur == 0) {
    long long int a, b;
    a = f(cur + 1, 1, 1) + n - cost[0];
    b = f(cur + 1, 0, 1) + cost[0];
    return min(a, b);
  } else {
    long long int a = 1000000007, b = 1000000007;
    if (cnt < y && cnt >= x) {
      a = f(cur + 1, pre, cnt + 1);
      b = f(cur + 1, 1 - pre, 1);
      if (pre == 0) {
        a += cost[cur];
        b += (n - cost[cur]);
      } else {
        a += (n - cost[cur]);
        b += cost[cur];
      }
      dp[cur][pre][cnt] = min(a, b);
    } else if (cnt < x) {
      dp[cur][pre][cnt] = f(cur + 1, pre, cnt + 1);
      if (pre == 0)
        dp[cur][pre][cnt] += cost[cur];
      else
        dp[cur][pre][cnt] += (n - cost[cur]);
    } else {
      dp[cur][pre][cnt] = f(cur + 1, 1 - pre, 1);
      if (pre == 0)
        dp[cur][pre][cnt] += (n - cost[cur]);
      else
        dp[cur][pre][cnt] += cost[cur];
    }
    return dp[cur][pre][cnt];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> x >> y;
  long long int mat[n][m];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      char z;
      cin >> z;
      if (z == '#')
        mat[i][j] = 1;
      else
        mat[i][j] = 0;
    }
  }
  memset(dp, -1, sizeof(dp));
  for (long long int i = 0; i < m; i++) {
    long long int zz = 0;
    for (long long int j = 0; j < n; j++) {
      zz += mat[j][i];
    }
    cost[i] = zz;
  }
  cout << '\n' << f(0, 0, 0);
}
