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]


from collections import defaultdict
from sys import stdin
from time import perf_counter

n, m, x, y = arr_inp()
mem = defaultdict(lambda: 1000001)

mat2 = [0 for i in range(m)]
for i in range(n):
    row = stdin.readline()[:-1]
    for j in range(m):
        if row[j] == '.':
            mat2[j] += 1

mem[1, 1, 1], mem[1, 1, 0] = n - mat2[0], mat2[0]

# print(perf_counter())
for i in range(1, m + 1):
    # '.' is 1 '#' is 0
    for j in range(y, 0, -1):
        plus = flip(0, i)
        if (i == m and j < x) or i < j:
            mem[i, j, 0] = 1000001
        else:
            if j > 1 and mem[i - 1, j - 1, 0] != 1000001:
                mem[i, j, 0] = plus + mem[i - 1, j - 1, 0]
            if j >= x:
                mem[i, 1, 1] = min(mem[i, 1, 1], flip(1, i) + mem[i - 1, j, 0])

        plus = flip(1, i)
        if (i == m and j < x) or i < j:
            mem[i, j, 1] = 1000001
        else:
            if j > 1 and mem[i - 1, j - 1, 1] != 1000001:
                mem[i, j, 1] = plus + mem[i - 1, j - 1, 1]
            if j >= x:
                mem[i, 1, 0] = min(mem[i, 1, 0], flip(0, i) + mem[i - 1, j, 1])

ans = float('inf')
for i in range(1, y + 1):
    ans = min(ans, mem[m, i, 1], mem[m, i, 0])

print(ans)
# print(perf_counter())
