You've got an *n* × *m* pixel picture. Each pixel can be white or black. Your task is to change the colors of as few pixels as possible to obtain a barcode picture.

A picture is a barcode if the following conditions are fulfilled: 
 -  All pixels in each column are of the same color. -  The width of each monochrome vertical line is at least *x* and at most *y* pixels. In other words, if we group all neighbouring columns of the pixels with equal color, the size of each group can not be less than *x* or greater than *y*.
The first line contains four space-separated integers *n*, *m*, *x* and *y* (1 ≤ *n*, *m*, *x*, *y* ≤ 1000; *x* ≤ *y*).

Then follow *n* lines, describing the original image. Each of these lines contains exactly *m* characters. Character "." represents a white pixel and "#" represents a black pixel. The picture description doesn't have any other characters besides "." and "#".
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n,m,x,y;
    cin>>n>>m>>x>>y;

    char bar[n][m];

    rep(i,0,n){
        rep(j,0,m){
            cin>>bar[i][j];
        }
    }

    vector<vector<int>> a(m,vector<int>(2,0));

    rep(i,0,m){
        rep(j,0,n){
            a[i][0] += (bar[j][i] == '#')?1:0;
            a[i][1] += (bar[j][i] == '.')?1:0;
        }
    }

    rep(i,1,m){
        a[i][0] += a[i-1][0];
        a[i][1] += a[i-1][1];
        // out2(a[i][0],a[i][1]);
    }
    vector<vector<int>> dp(m,vector<int>(2,inf));
    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    rep(i,1,m){
        for ( int j = x ; j <= y ; j++ ){
            dp[i][0] = ((i-j>=0)?dp[i-j][1]:0) + a[i][0] - ((i-j>=0)?a[i-j][0]:0);
            dp[i][1] = ((i-j>=0)?dp[i-j][0]:0) + a[i][1] - ((i-j>=0)?a[i-j][1]:0);
        }
    }

    cout<<min(dp[m-1][0],dp[m-1][1])<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;
    for ( int i = 1 ; i <= t ; i++ ){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}

