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 arr_inp():
    return [int(x) for x in stdin.readline().split()]


def get_col(arr, i):
    return [row[i] for row in arr]


def str_inp(n):
    return [stdin.readline()[:-1] for x in range(n)]


def flip(x, i):
    if x:
        return n - mat2[i - 1]
    else:
        return mat2[i - 1]


def arr_sum(arr):
    arr.insert(0, 0)
    return list(accumulate(arr, lambda x, y: x + y))


from collections import defaultdict
from sys import stdin
from itertools import accumulate

n, m, x, y = arr_inp()
mat, mem = str_inp(n), defaultdict(lambda: float('inf'))
mat2 = [n - get_col(mat, i).count('#') for i in range(m)]

# if x==y:
#     print()
mem[1, 1, True], mem[1, 1, False] = n - mat2[0], mat2[0]
for i in range(1, m + 1):
    # '.' is 1 '#' is 0
    for j in range(y, 0, -1):
        for k in [True, False]:
            plus = flip(k, i)

            if (i == m and j < x) or i < j:
                mem[i, j, k] = float('inf')
            else:
                if j > 1 and mem[i - 1, j - 1, k] != float('inf'):
                    mem[i, j, k] = plus + mem[i - 1, j - 1, k]
                if j >= x:
                    if mem[i, 1, not k] == -1:
                        mem[i, 1, not k] = flip(not k, i) + mem[i, j, k]
                    else:
                        mem[i, 1, not k] = min(mem[i, 1, not k], flip(not k, i) + mem[i - 1, j, k])
ans = float('inf')
for i in range(1, y + 1):
    ans = min(ans, mem[m, i, True], mem[m, i, False])

print(ans)

