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 getMin(colIdx, matrix, widthMin, widthMax, currentWidth, code, cache):
    currentMin = 0
    if colIdx == len(matrix[0]):
        return 0
    if (colIdx, currentWidth, code) in cache:
        return cache[(colIdx, currentWidth, code)]
    for i in range(len(matrix)):
        if matrix[i][colIdx] != code:
            currentMin += 1

    newCode = "#" if code == "." else "."
    if currentWidth < widthMin:
        currentMin += getMin(colIdx + 1, matrix, widthMin,
                             widthMax, currentWidth + 1, code, cache)
    elif currentWidth == widthMax:
        currentMin += getMin(colIdx + 1, matrix, widthMin,
                             widthMax, 1, newCode, cache)
    else:
        currentMin += min(getMin(colIdx + 1, matrix, widthMin, widthMax, currentWidth + 1,
                          code, cache), getMin(colIdx + 1, matrix, widthMin, widthMax, 1, newCode, cache))
    cache[(colIdx, currentWidth, code)] = currentMin
    return currentMin


n, m, widthMin, widthMax = map(int, input().split())
matrix = []
for i in range(n):
    currentInput = input()
    matrix.append(currentInput)
cache = {}
currentMin = min(getMin(0, matrix, widthMin, widthMax, 1, ".", cache),
                 getMin(0, matrix, widthMin, widthMax, 1, "#", cache))
print(currentMin)
