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 "#".
def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = stack.append(f(*args, **kwargs))
            while True:
                try:
                    to = stack.append(stack[-1].send(to))
                except StopIteration as e:
                    stack.pop()
                    to = e.value
                    if not stack:
                        break
            return to
 
    return wrappedfunc
 
@bootstrap
def go(ind,lastc,prev):
    c1 = 10**9 
    c2 = 10**9
    if (ind==m):
        if ((m-prev)<x):
            return (10**9) 
        return 0 
    if (dp[ind][lastc][prev]!=-1):
        return dp[ind][lastc][prev]
    
    # 0 --> white 
    # 1 --> black 
    

    #same 
    if (prev<y):
        if (lastc==0):
            c1 = (black[ind]) + (yield go(ind+1,lastc,prev+1)) 
        else:
            c1 = (n-(black[ind])) + (yield go(ind+1,lastc,prev+1)) 
    

    #Diff
    if (prev>=x):
        if (lastc==0):
            c2 = (n-(black[ind])) + (yield go(ind+1,lastc^1,0)) 
        else:
            c2 = black[ind] + (yield go(ind+1,lastc^1,0))  
    

    ans = min(c1,c2) 
    dp[ind][lastc][prev]=ans 
    return ans 







n,m,x,y = map(int,input().split()) 
lst = [ ] 
for i in range(n):
    s = input() 
    lst.append(s) 

black = [ ] 
for i in range(m):
    ct=0 
    for j in range(n):
        if (lst[j][i]=='#'):
            ct+=1 
    black.append(ct) 

# print(black)
dp=[ ] 
for i in range(m):
    a = [ ]
    for j in range(2):
        b = [ ]
        for k in range(m):
            b.append(-1) 
        a.append(b) 
    dp.append(a) 



print(min(go(0,0,0),go(0,1,0))) 