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 "#".
class Solution():
    def __init__(self, n, m, x, y, count_dots, memo):
        self.n = n
        self.m = m
        self.x = x
        self.y = y
        self.count_dots = count_dots
        self.memo = memo

    def solve(self, col, width, last):
        if col == self.m:
            if self.x <= width  and width <= self.y:
                return 0
            else:
                return float('inf')

        ans = self.memo[col][width][last]

        if ans != -1:
            return ans

        dots = 1000000
        still_can_put_dots = last == 0 and width < self.y
        can_change_to_dots = last == 1 and self.x <= width
        if col == 0 or still_can_put_dots or can_change_to_dots:
            new_width = 1 if last != 0 else width + 1
            dots = self.n - self.count_dots[col]
            dots += self.solve(col + 1, new_width, 0)
        
        hashes = 1000000
        still_can_put_hashes = last == 1 and width < self.y
        can_change_to_hashes = last == 0 and self.x <= width
        if col == 0 or still_can_put_hashes or can_change_to_hashes:
            new_width = 1 if last != 1 else width + 1
            hashes = self.count_dots[col]
            hashes += self.solve(col + 1, new_width, 1)

        ans = min(dots, hashes)
        self.memo[col][width][last] = ans

        return ans
    

def main():
    n, m, x, y = map(int, input().split())
    count_dots = [0]*m
    for _ in range(n):
        line = input()
        for i, ch in enumerate(line):
            if ch == '.':
                count_dots[i] += 1
    memo = [[[-1 for _ in range(3)] for _ in range(y+1)] for _ in range(m)]
    obj = Solution(n, m, x, y, count_dots, memo)
    col = 0
    width = 0
    mode = 2 # Nothing
    sol = obj.solve(col, width, mode)
    print(sol)

if __name__ == '__main__':
    main()
