#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m) {
  long long ret = 1;
  while (b) {
    if (b % 2) ret = ((ret % m) * (a % m)) % m;
    a = ((a % m) * (a % m)) % m;
    b >>= 1;
  }
  return ret;
}
pair<long long, long long> a[1001];
long long n, m, x, y;
long long dp[1001][2];
long long func(int i, int mode) {
  if (i >= m) return 0;
  if (dp[i][mode] != -1) return dp[i][mode];
  long long ans = INT_MAX;
  for (int j = i + x - 1; j <= i + y - 1; j++) {
    if (j >= m) break;
    long long t;
    if (mode == 0) {
      t = a[j].first - a[i - 1].first;
    } else {
      t = a[j].second - a[i - 1].second;
    }
    t += func(j + 1, mode ^ 1);
    ans = min(ans, t);
  }
  dp[i][mode] = ans;
  return ans;
}
int main() {
  scanf("%lld", &n);
  scanf("%lld", &m);
  scanf("%lld", &x);
  scanf("%lld", &y);
  char s[n][m];
  for (int i = 0; i < n; i++) {
    string str;
    cin >> str;
    for (int j = 0; j < m; j++) s[i][j] = str[j];
  }
  for (int i = 0; i < m; i++) {
    long long c1, c2;
    c1 = c2 = 0;
    for (int j = 0; j < n; j++) {
      if (s[j][i] == '#')
        c1++;
      else
        c2++;
    }
    a[i] = make_pair(c1, c2);
  }
  for (int i = 1; i < m; i++) {
    a[i].first += a[i - 1].first;
    a[i].second += a[i - 1].second;
  }
  memset(dp, -1, sizeof(dp));
  cout << min(func(0, 0), func(0, 1));
  return 0;
}
