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 "#".
# 225 C Barcode

BLACK = "#"
WHITE = "."


class LowestCost(object):
    def __init__(self):
        self.cost = None


class LineChoice(object):
    def __init__(self, color: str, width: int):
        self.color = color
        self.width = width


def read_original_code(n_lines, m_chars):
    counts_blacks = [0] * m_chars
    counts_whites = [0] * m_chars
    # read each line
    for i in range(n_lines):
        line = list(input())
        # compare elements
        for col_i, in_char in enumerate(line):
            counts_blacks[col_i] += 1 if in_char == BLACK else 0
            counts_whites[col_i] += 1 if in_char == WHITE else 0

    return counts_blacks, counts_whites


def create_cum_counts(counts):
    cum_count = 0
    for col_i, col_count in enumerate(counts):
        cum_count += col_count
        counts[col_i] = cum_count
    return counts


def cost_from_counts(counts, start, end):
    if start == 0:
        return counts[end-1]
    else:
        return counts[end-1] - counts[start-1]


def calc_choice_cost(prev_choice, m_used_cols, cum_blacks, cum_whites):
    if prev_choice.color == BLACK:
        return cost_from_counts(cum_whites, m_used_cols - prev_choice.width, m_used_cols)
    else:
        return cost_from_counts(cum_blacks, m_used_cols - prev_choice.width, m_used_cols)


def combine(cur_cost, lowest_cost, m_cols, m_used_cols, allowed_range: range,
            prev_choice, cum_blacks, cum_whites):
    # update cur costs
    if prev_choice is not None:
        cur_cost += calc_choice_cost(prev_choice, m_used_cols, cum_blacks, cum_whites)

    # we depleted all lines, return the cost only if it is better
    if m_used_cols == m_cols:
        if lowest_cost.cost is None:
            lowest_cost.cost = cur_cost
        elif cur_cost < lowest_cost.cost:
            lowest_cost.cost = cur_cost
        return
    # we don't need to even finish this
    elif lowest_cost.cost is not None and lowest_cost.cost < cur_cost:
        return
    else:
        for width in allowed_range:
            if width + m_used_cols > m_cols:
                break
            if prev_choice is None:
                new_choice = LineChoice(BLACK, width)
                combine(cur_cost, lowest_cost, m_cols, m_used_cols + width, allowed_range, new_choice, cum_blacks,
                        cum_whites)

                new_choice = LineChoice(WHITE, width)
                combine(cur_cost, lowest_cost, m_cols, m_used_cols + width, allowed_range, new_choice, cum_blacks,
                        cum_whites)
            else:
                new_choice = LineChoice(BLACK, width) if prev_choice.color == WHITE else LineChoice(WHITE, width)
                combine(cur_cost, lowest_cost, m_cols, m_used_cols + width, allowed_range, new_choice, cum_blacks,
                        cum_whites)


def main():
    lowest_cost = LowestCost()
    n, m, x, y = [int(char_int) for char_int in input().split(' ')]
    counts_blacks, counts_whites = read_original_code(n, m)
    cum_blacks = create_cum_counts(counts_blacks)
    cum_whites = create_cum_counts(counts_whites)

    combine(cur_cost=0, lowest_cost=lowest_cost, m_cols=m, m_used_cols=0,
            allowed_range=range(x, y + 1), prev_choice=None,
            cum_blacks=cum_blacks, cum_whites=cum_whites)
    print(lowest_cost.cost)


if __name__ == '__main__':
    main()
