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 "#".
param1 = str(input()).split()
n,m,x,y = [int(i) for i in param1]
grid=[]
count=[]
for i in range(n):
    row = str(input())
    grid.append(row)
for i in range(m):
    count_m=0
    for j in range(n):
        if grid[j][i]=='#':
            count_m+=1
    count.append(count_m)

count_sum=[0 for i in range(m)]
count_sum_2=[0 for i in range(m)]
count_sum[0]=count[0]
count_sum_2[0]=n-count[0]
for i in range(1,m):
    count_sum[i]=count_sum[i-1]+count[i]
    count_sum_2[i]  = count_sum_2[i-1] + (n-count[i])

MAX=1000000

#print(count_sum)
#print(count_sum_2)

dp1=[[0 for i in range(y+2-x)] for j in range(m)]
dp2=[[0 for i in range(y+2-x)] for j in range(m)]
dp3=[0 for i in range(m)]
dp4=[0 for i in range(m)]
for i in range(m):
    min_1 = MAX
    min_2 = MAX
    for index in range(x,y+1):
        r = index-x+1
        if (i+1<r):
            continue
        
        # i - j + 1 = r --> j = i-r+1
        #Including ith index r things so start index : i-r+1 to i
        #Therefore to get the sum we need count_sum[i] - count_sum[i-r]
        #dp1[i][r] to dp2[j][.....]
        if i<r:
            dp1[i][r] = count_sum[i]
            dp2[i][r] = count_sum_2[i]
        
        else:
            dp1[i][r] = count_sum[i]-count_sum[i-r] + dp3[i-r]
            dp2[i][r] = count_sum_2[i]-count_sum_2[i-r] + dp4[i-r]
            #dp2[i][r] = (n*(i+1)-count_sum[i]) - (n*(i-r+1)-count_sum[i-r]) + dp4[i-r]
        
        min_1 = min(min_1,dp1[i][r])
        min_2 = min(min_2,dp2[i][r])


    #This means dp1 and dp2 has been calculated
    #for i
    dp3[i] = min_2
    dp4[i] = min_1


if dp3[m-1]<dp4[m-1]:
    print(dp3[m-1])
else:
    print(dp4[m-1])

#print(dp3)
#print(dp4)


    







            
