Sanggeun's farm is wide enough that he has to write down which plant went where. To keep that record he ordered a high resolution map from an online shop. The map is far too big for a single sheet of paper, so he has to split it across several sheets.
The number of sheets changes with the way the paper is laid over the map. A map shaped like Texas, for example, takes 14 sheets under a bad placement, while sheets of the same size cover it with 10 under a good one.
Every side of a sheet is parallel to the x axis or the y axis. A sheet cannot be rotated, and two sheets may touch only when they share a whole side. The sheets therefore sit on one regular lattice, and the only thing to decide is how far to slide that lattice horizontally and vertically. Only the lattice cells that hold at least one 'X' are actually printed.
Given the map and the size of one sheet, write a program that finds the smallest number of sheets needed to print the map.
The input holds several test cases and continues until the input ends.
The first line of each test case has four integers Ar, Ac, Tr, Tc. Ar and Ac are the height and the width of the map in pixels, and Tr and Tc are the height and the width in pixels that one sheet can print. (1≤Ar,Ac≤1000, 1≤Tr,Tc≤100)
Each of the next Ar lines has Ac characters with no spaces. 'X' is part of Sanggeun's farm and '.' is not.
Every 'X' has to be printed, and all the 'X' characters of one map are connected into a single region.
For each test case, print the smallest number of sheets needed to print every 'X', one per line.