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 "#".
from collections import defaultdict
def preprocess(img):
	data = [defaultdict(int) for i in range(m)]

	for row in img:
		for idx, pix in enumerate(row):
			data[idx][pix] += 1

	return data

def complement(x):
	if x == '#':
		return '.'
	else:
		return '#'

def get_min_steps(col, last_color, width, img_data, states, n, m, x, y):
	if col == m:
		return 0;

	if (col, last_color, width) in states:
		return states[(col, last_color, width)]

	steps = 0
	
	if width < x and width > 0:
		steps =  n - img_data[col][last_color] + get_min_steps(col+1, last_color, width+1, img_data, states, n, m, x, y)
		states[(col, last_color, width)] = steps
		return steps

	elif width < y:
		steps_same =  n - img_data[col][last_color] + get_min_steps(col+1, last_color, width+1, img_data, states, n, m, x, y)
		steps_change = img_data[col][last_color] + get_min_steps(col+1, complement(last_color), 1, img_data, states, n, m, x, y)
		states[(col, last_color, width)] = min(steps_change, steps_same)
		return states[(col, last_color, width)]

	else:
		steps = img_data[col][last_color] + get_min_steps(col+1, complement(last_color), 1, img_data, states, n, m, x, y)
		states[(col, last_color, width)] = steps
		return steps


if __name__ == '__main__':
	n, m, x, y = map(int, input().split())
	img = list()

	for i in range(n):
		img.append(list(input()))

	img_data = preprocess(img)
	states = defaultdict(int)

	print(get_min_steps(0,'.', 0, img_data, states, n, m, x, y))