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 "#".
# cook your dish here
import sys
import math
import random
import heapq
#sys.setrecursionlimit(10**6)
input=sys.stdin.readline
def pow(a,n,m):
    if n==0:
        return 1 
    x=pow(a,n//2,m)
    if n%2==0 :
        return (x*x)%m 
    else:
        return (x*x*a)%m
 
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a 
    
def bs(arr,le,ri):
    l=0
    arr.sort()
    r=len(arr)-1
    ans=10000000
    while l<=r:
        m=(l+r)//2
        if arr[m]>=le and arr[m]<=ri:
            ans=arr[m]
            r=m-1
        elif arr[m]<le:
            l=m+1 
        else:
            r=m-1
    return ans
def fun(s,x,y,dp,co,c,n,m):
    if s==m:
        return 0
    if m-s<x:
        return n*m+1 
    if dp[s][c]<n*m+1:
        return dp[s][c]
    te=sum(co[c][s:s+x-1])
    for i in range(s+x,min(s+y+1,m+1)):
        te+=co[c][i-1]
        dp[s][c]=min(dp[s][c],fun(i,x,y,dp,co,1-c,n,m)+te)
    return dp[s][c]    

 
t=1 
# t=int(input())
while t>0:
    n,m,x,y=map(int,input().split())
    c=[[0]*m for i in range(2)] 
    for i in range(n):
        s=input().strip()
        for j in range(m):
            if s[j]=='#':
                c[0][j]+=1
            else:
                c[1][j]+=1
    # print(c)
    dp=[[n*m+1]*2 for j in range(m)]
    fun(0,x,y,dp,c,0,n,m)
    # print(dp)
    fun(0,x,y,dp,c,1,n,m)
    # print(dp)
    print(min(dp[0][0],dp[0][1]))
    t-=1
            