#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 1, -1, 2, 2, -2, -2}, dy[] = {2, 2, -2, -2, 1, -1, 1, -1};
bool is_prime(long long x) {
  if (x <= 1) return false;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
bool is_palindrome(string s1) {
  int l = s1.length();
  for (int i = 0; i < l / 2; i++)
    if (s1[i] != s1[l - i - 1]) return false;
  return true;
}
unsigned long long C(long long n, long long k) {
  if (k == 0) return 1;
  return (n * C(n - 1, k - 1)) / k;
}
long long modular_pow(long long base, long long exponent, int modulus) {
  long long result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long binaryToDec(string number) {
  long long result = 0, pow = 1;
  for (int i = number.length() - 1; i >= 0; --i, pow <<= 1)
    result = (result + (number[i] - '0') * pow) % 1000003;
  return result;
}
long long binaryToDec2(string number) {
  long long result = 0, pow = 1;
  int l = number.length();
  for (int i = 0; i < l; ++i, pow <<= 1)
    result = (result + (number[i] - '0') * pow) % 1000003;
  return result;
}
string decimalToBin(int number) {
  if (number == 0) return "0";
  if (number == 1) return "1";
  if (number % 2 == 0)
    return decimalToBin(number / 2) + "0";
  else
    return decimalToBin(number / 2) + "1";
}
unsigned long long GCD(unsigned long long a, unsigned long long b) {
  return b == 0 ? a : GCD(b, a % b);
}
unsigned long long LCM(unsigned long long i, unsigned long long j) {
  return (i * j) / GCD(i, j);
}
int cntMask(int mask) {
  int ret = 0;
  while (mask) {
    if (mask % 2) ret++;
    mask /= 2;
  }
  return ret;
}
int getBit(int mask, int i) { return ((mask >> i) & 1) == 1; }
int setBit(int mask, int i, int value = 1) {
  return (value) ? mask | (1 << i) : (mask & ~(1 << i));
}
unsigned long long mystoi(string s) {
  unsigned long long ans = 0;
  unsigned long long po = 1;
  for (int i = s.length() - 1; i >= 0; i--) {
    ans += (s[i] - '0') * po;
    po *= 10;
  }
  return ans;
}
string conv(int i) {
  string t = "";
  while (i) {
    t += '0' + (i % 10);
    i /= 10;
  }
  return t;
}
bool hasZero(int i) {
  if (i == 0) return true;
  while (i) {
    if (i % 10 == 0) return true;
    i /= 10;
  }
  return false;
}
bool isSortedAc(int a[], int n) {
  for (int i = 0; i < int(n - 1); i++)
    if (a[i] > a[i + 1]) return false;
  return true;
}
bool isSortedDec(int a[], int n) {
  for (int i = 0; i < int(n - 1); i++)
    if (a[i] < a[i + 1]) return false;
  return true;
}
bool cmp(unsigned long long i, unsigned long long j) { return i > j; }
long long range_sum(long long l, long long r) {
  long long one = r * (r + 1) / 2;
  long long two = (l - 1) * (l + 2) / 2;
  return one - two;
}
int n, m, a[1000 + 5] = {0};
int x, y;
int memo[1000 + 5][1000 + 5][2];
char grid[1000 + 5][1000 + 5];
int solve(int i = 0, int total = 0, int black = 0) {
  if (total > y) return 2000000;
  if (i == m) return (total >= x && total <= y) ? 0 : 2000000;
  int &ret = memo[i][total][black];
  if (ret != -1) return ret;
  ret = 3000000;
  if (i == 0) {
    return ret = min(a[i] + solve(i + 1, 1, 0), n - a[i] + solve(i + 1, 1, 1));
  } else {
    if (black) {
      ret = n - a[i] + solve(i + 1, total + 1, 1);
      if (total >= x) ret = min(ret, a[i] + solve(i + 1, 1, 0));
    } else {
      ret = a[i] + solve(i + 1, total + 1, 0);
      if (total >= x) ret = min(ret, n - a[i] + solve(i + 1, 1, 1));
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> x >> y;
  for (int i = 0; i < int(n); i++)
    for (int j = 0; j < int(m); j++) cin >> grid[i][j];
  for (int i = 0; i < int(m); i++)
    for (int j = 0; j < int(n); j++)
      if (grid[j][i] == '#') a[i]++;
  memset(memo, -1, sizeof(memo));
  ;
  cout << solve() << endl;
  return 0;
}
