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 "#".
'''input
6 5 1 2
##.#.
.###.
###..
#...#
.##.#
###..
'''
# connected components
from sys import stdin
from collections import defaultdict
import sys

def calculate_cost(matrix, n, m):
	white_cost = []
	black_cost = []
	for i in range(m):
		bcount = 0; wcount = 0
		for j in range(n):
			if matrix[j][i] == '.':
				bcount += 1
			else:
				wcount += 1
		white_cost.append(wcount)
		black_cost.append(bcount)
	return black_cost, white_cost


def brute(dp, matrix, n, m, x, y, black_cost, white_cost, index, w, b):
	#print(index, w, b)
	if index >= m:
		if w != 0 and w >= x:
			return 0
		if b != 0 and b >= x:
			return 0
		return float('inf')
	else:
		if w == 0:
			if dp[0][index] != -1:
				return dp[0][index]
		else:
			if dp[1][index] != -1:
				return dp[1][index]

		c1 = float('inf'); c2 = float('inf'); c3 = float('inf'); c4 = float('inf')
		if w < x:
			c1 = 0
			cw = w
			i = index
			while cw < x:
				c1 += white_cost[i]	
				i +=  1; cw += 1
			c1 += brute(dp, matrix, n, m, x, y, black_cost, white_cost, i, cw, 0)
		
		if b < x:
			c2 = 0
			cb = b
			i = index

			while cb < x:
				c2 += black_cost[i]
				i += 1; cb += 1
			c2 += brute(dp, matrix, n, m, x, y, black_cost, white_cost, i, 0, cb)
		
		if w >= x and w + 1 <= y:
			c3 = white_cost[index] + brute(dp, matrix, n, m, x, y, black_cost, white_cost, index + 1, w + 1, 0)
		
		if b >= x and b + 1 <= y:
			c4 = black_cost[index] + brute(dp, matrix, n, m, x, y, black_cost, white_cost, index + 1, 0, b + 1)
		
		if w == 0:
			dp[0][index] = min(c1, c2, c3, c4)
		if b == 0:
			dp[1][index] = min(c1, c2, c3, c4)
		return min(c1, c2, c3, c4)


# main starts
n, m, x, y = list(map(int, stdin.readline().split()))
matrix = []
for _ in range(n):
	matrix.append(list(stdin.readline().strip()))
black_cost, white_cost = calculate_cost(matrix, n, m)
#print(black_cost, white_cost)
dp = [[-1 for j in range(m)] for k in range(2)]
print(brute(dp, matrix, n, m, x, y, black_cost, white_cost, 0, 0, 0))
#print(dp)
