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 math import inf

n,m,x,y = map(int,input().split())
cols = [0]*m
for i in range(n):
  line = input()
  for i in range(m):
    if line[i]=='.':
      cols[i]+=1

def valid(j):
  return  -1<j<m

mem = [[[-1]*3 for _ in range(m+1)  ] for _ in range(m+1)]

def paint(j=0,prev=2,width = 0):
  if not valid(j):
    if x<= width <=y:
      return 0
    return inf
  if mem[j][width][prev] !=-1:
    return mem[j][width][prev] 

  if prev == 0:
    if width <x:
      mem[j][width][prev] = n- cols[j] + paint(j+1,0,width+1)
      return mem[j][width][prev] 
    if width == y :
      mem[j][width][prev] = cols[j] + paint(j+1,1,1)
      return mem[j][width][prev] 
  if prev == 1: 
    if width <x:
      mem[j][width][prev] = cols[j]+ paint(j+1,1,width+1)
      return mem[j][width][prev] 
    if width == y :
      mem[j][width][prev] = n- cols[j] + paint(j+1,0,1)
      return mem[j][width][prev] 

  p1 = n-cols[j]+ paint(j+1,0, width+1 if prev == 0 else 1)
  p2 = cols[j] + paint(j+1,1,width+1 if prev==1 else 1)
  mem[j][width][prev]  = min(p1,p2)
  return mem[j][width][prev] 




print(paint())


