#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9 +7 ;
char bar[1005][1005];
int dp[3][2005];
int white[1005]={0};
int sum[1005];
int main()
{
int n,m,x,y;
cin>>n>>m>>x>>y;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>bar[i][j];
if(bar[i][j]=='.') white[j]++;
}
}
dp[0][0]=0;
dp[1][0]=0;
for(int i=0;i<m;i++) sum[i+1]=sum[i]+white[i];
memset(dp,INT_MAX ,sizeof(dp));
for(int i=0;i<m;i++){
for(int j=x;j<=y;j++){
if(i+j>m){break;}
dp[0][i+j]=min(dp[0][i+j],dp[1][i]+sum[i+j]-sum[i]);
dp[1][i+j]=min(dp[1][i+j],dp[0][i]+(j)*n-(sum[i+j]-sum[i]));
}
}
cout<<min(dp[0][m],dp[1][m])<<endl;;
return 0;
}
IAojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOyAKY29uc3QgaW50IE1PRD0xZTkgKzcgOyAKCmNoYXIgYmFyWzEwMDVdWzEwMDVdOyAKaW50IGRwWzNdWzIwMDVdOyAKaW50IHdoaXRlWzEwMDVdPXswfTsgCmludCBzdW1bMTAwNV07CmludCBtYWluKCkKewoJCglpbnQgbixtLHgseTsgCgljaW4+Pm4+Pm0+Png+Pnk7IAoKCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCWZvcihpbnQgaj0wO2o8bTtqKyspewoJCQljaW4+PmJhcltpXVtqXTsKCQkJaWYoYmFyW2ldW2pdPT0nLicpIHdoaXRlW2pdKys7ICAgCgkJfQoJfQoKCiBkcFswXVswXT0wOyAKIGRwWzFdWzBdPTA7IAoKZm9yKGludCBpPTA7aTxtO2krKykgc3VtW2krMV09c3VtW2ldK3doaXRlW2ldOwoKbWVtc2V0KGRwLElOVF9NQVggLHNpemVvZihkcCkpOyAKCmZvcihpbnQgaT0wO2k8bTtpKyspewoJZm9yKGludCBqPXg7ajw9eTtqKyspewoJCWlmKGkraj5tKXticmVhazt9CgoJCWRwWzBdW2kral09bWluKGRwWzBdW2kral0sZHBbMV1baV0rc3VtW2kral0tc3VtW2ldKTsKCQlkcFsxXVtpK2pdPW1pbihkcFsxXVtpK2pdLGRwWzBdW2ldKyhqKSpuLShzdW1baStqXS1zdW1baV0pKTsgCgl9CQp9CgoKY291dDw8bWluKGRwWzBdW21dLGRwWzFdW21dKTw8ZW5kbDs7CgpyZXR1cm4gMDsgICAKfQ==