#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long, pair<long long, long long> > &a,
               const pair<long long, pair<long long, long long> > &b) {
  return (a.second.first < b.second.first);
}
bool sortbyth(const pair<long long, pair<long long, long long> > &a,
              const pair<long long, pair<long long, long long> > &b) {
  return (a.second.second < b.second.second);
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
long long max3(long long a, long long b, long long c) {
  return max(max(a, b), c);
}
long long max4(long long a, long long b, long long c, long long d) {
  return max(max(a, b), max(c, d));
}
long long min3(long long a, long long b, long long c) {
  return min(min(a, b), c);
}
long long min4(long long a, long long b, long long c, long long d) {
  return min(min(a, b), min(c, d));
}
long long po(long long x, long long n, long long mod = 998244353) {
  if (n == 0) {
    return 1;
  }
  long long m = po(x, n / 2, mod);
  m *= m;
  m %= mod;
  if (n % 2) {
    m *= x;
    m %= mod;
  }
  return m;
}
long long n, m, x, y;
long long col[2][1005];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  clock_t startTime = clock();
  cin >> n >> m >> x >> y;
  char a[1005][1005];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (long long i = 0; i < m; i++) {
    long long c = 0;
    for (long long j = 0; j < n; j++) {
      if (a[j][i] == '#') {
        c++;
      }
    }
    col[0][i] = c;
    col[1][i] = n - c;
  }
  long long dp[2][2][1005] = {};
  for (long long i = 0; i < 2; i++) {
    for (long long j = 0; j < 1005; j++) {
      if (j >= x || j == 0) {
        dp[1][i][j] = 0;
      } else {
        dp[1][i][j] = INT_MAX;
      }
    }
  }
  for (long long index = m - 1; index >= 0; index--) {
    for (long long last = y - 1; last >= 0; last--) {
      for (long long color = 0; color < 2; color++) {
        if (last == y - 1) {
          dp[0][color][last] = dp[1][1 ^ color][0] + col[color][index];
        } else if (last < x - 1) {
          dp[0][color][last] = dp[1][color][last + 1] + col[color][index];
        } else {
          dp[0][color][last] =
              min(dp[1][color][last + 1], dp[1][1 ^ color][0]) +
              col[color][index];
        }
      }
    }
    for (long long last = y - 1; last >= 0; last--) {
      for (long long color = 0; color < 2; color++) {
        dp[1][color][last] = dp[0][color][last];
      }
    }
  }
  cout << min(dp[0][0][0], dp[0][1][0]) << "\n";
}
