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 "#".
import abc
import itertools
import math
from math import gcd as gcd
import sys
import queue
import itertools
from heapq import heappop, heappush
import random
from array import array
from bisect import *

# input = lambda: sys.stdin.buffer.readline().decode().strip()
# inp = lambda dtype: [dtype(x) for x in input().split()]
debug = lambda *x: print(*x, file=sys.stderr)
ceil1 = lambda a, b: (a + b - 1) // b
Mint, Mlong, out = 2 ** 31 - 1, 2 ** 63 - 1, []


# Solution starts here
def solve():
    n, m, x, y = map(int, sys.stdin.readline().split())
    # f_i - number of # in column i
    f = [0 for i in range(m)]

    for i in range(n):
        e = str(sys.stdin.readline()[:-1])
        for j in range(m):
            f[j] += int(e[j] == "#")

    pref_sum = [0 for i in range(m + 1)]
    for i in range(m):
        pref_sum[i + 1] = pref_sum[i] + f[i]

    last_black = [1<<60 for i in range(m)]
    last_white = [1<<60 for i in range(m)]

    for i in range(x - 1, m):
        for size in range(x, min(y, i + 1) + 1):
            # try to make black strip
            s = pref_sum[i + 1] - pref_sum[i + 1 - size]
            last_black[i] = min(last_black[i], last_white[i - size] + size * n - s if i - size >= 0 else size * n - s)

            # try to make white strip
            s = pref_sum[i + 1] - pref_sum[i + 1 - size]
            last_white[i] = min(last_white[i], last_black[i - size] + s if i - size >= 0 else s)

    #print(last_black)
    #print(last_white)
    print(min(last_black[-1], last_white[-1]))
    return


if __name__ == '__main__':
    multi_test = 0

    if multi_test == 1:
        t = int(sys.stdin.readline())
        for _ in range(t):
            solve()
    else:
        solve()
