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 "#".
from functools import lru_cache
@lru_cache(maxsize=None)
def solve() : 
    bc=[0 for i in range(m)]
    wc=[0 for i in range(m)]

    for i in range(n) :
        for j in range(m) :
            if arr[i][j]=='#' :
                bc[j]+=1
            else:
                wc[j]+=1
    for i in range(1,m):
        bc[i]+=bc[i-1]
        wc[i]+=wc[i-1]
    bc=[0]+bc
    wc=[0]+wc


    dp=[[float('inf')]*(m+1) for i in range(2)]
    dp[0][0]=0
    dp[1][0]=0
    for i in range(1,m+1):
        for a in range(x,y+1):
            if i-a>=0:
                dp[0][i]=min(dp[0][i],dp[1][i-a]+bc[i]-bc[i-a])
                dp[1][i]=min(dp[1][i],dp[0][i-a]+wc[i]-wc[i-a])
  
    return min(dp[0][m],dp[1][m])
            



 
 



#from bisect import bisect_left as bisect
from math import ceil,floor
from  collections import defaultdict,Counter
from sys import stdin ,stdout  #, setrecursionlimit
input = stdin.buffer.readline   
import threading
out=stdout.write 
#setrecursionlimit(100002)   

n,m,x,y= list(map(int, input().split()))
arr=[list(input().strip().decode("utf-8")) for _ in range(n)]
out(str(solve())+'\n')
quit()

for _ in range(int(input())) :
    n,k= list(map(int, input().split()))
    arr=list(map(int, input().split()))
    out(str(solve())+'\n')

'''

threading.stack_size(2**24)
t = threading.Thread(target=main)
t.start()
t.join()





for _ in range(int(input())) :
    n=int(input())
    print(solve())


n=int(input())

x=input().strip().decode("utf-8")


n,m= list(map(int, input().split()))


n=int(input())
    arr=list(map(int, input().split()))

n,k= list(map(int, input().split()))
arr=list(map(int, input().split()))


arr=list(map(int, input().strip().decode("utf-8")))


n,m= [int(x) for x in input().split()]
arr=[list(map(int, input().split())) for _ in range(n)]


n,m= [int(x) for x in input().split()]
arr=[list(map(int, input().strip().decode("utf-8"))) for _ in range(n)]



n=int(input())
arr=[list(map(int, input().split())) for _ in range(n)]



n,m= list(map(int, input().split()))
    arr=[list(input().strip().decode("utf-8")) for _ in range(n)]




for _ in range(int(input())) :
    

    n=int(input())
    arr=list(map(int, input().split()))

    d={}
    leaves={}

    for i in range(n):
        d[i+1]=[]
        leaves[i+1]=1
    
    for i in range(1,n):
        d[arr[i-1]].append(i+1)
        if arr[i-1] in leaves :
            leaves.pop(arr[i-1])






'''







