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 "#".
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug  1 22:57:03 2020

@author: divyarth
"""

import sys
import heapq
import math
sys.setrecursionlimit(100000)

from collections import deque
from collections import defaultdict
from collections import Counter

#input=sys.stdin.readline
#print=sys.stdout.write

def PRINT(lst,sep=' '): print(sep.join(map(str,lst)))
I=lambda : list(map(int,input().split(' ')))

def solve():
    return

n,m,x,y=I()
bar=[list(input()) for _ in range(n)]

def COL(k): return [bar[i][k] for i in range(n)]
row=[]
for i in range(m):
    c=dict(Counter(COL(i)))
    row.append(( c['#'] if '#' in c else 0))
                   
s_arr=[0]
for r in row: 
    s_arr.append(s_arr[-1]+r)
    
def SUM(l,r):
    return s_arr[r+1]-s_arr[l]

mem={}
import time
global arr
def rec(start,color):
    
    if (start,color) in mem:
        return mem[(start,color)]
    elif start==m:
        return 0
    
    mm=float('inf')
    for end in range(start+x-1,start+y):
        if end>=m: continue
        ss=SUM(start,end) if color=='b' else (end-start+1)*n-SUM(start,end)
        #print(start,end,ss,(end-start+1)*n-ss)
        mm=min(mm,ss+rec(end+1,'w' if color=='b' else 'b'))
        
        
    mem[(start,color)]=mm        
    
    return mm

print(min(rec(0,'w'),rec(0,'b')))