Paper Map

No attempts yetTime limit3sMemory limit128 MB

Problem

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.

Input

The input holds several test cases and continues until the input ends.

The first line of each test case has four integers ArA_r, AcA_c, TrT_r, TcT_c. ArA_r and AcA_c are the height and the width of the map in pixels, and TrT_r and TcT_c are the height and the width in pixels that one sheet can print. (1Ar,Ac10001 \le A_r, A_c \le 1000, 1Tr,Tc1001 \le T_r, T_c \le 100)

Each of the next ArA_r lines has AcA_c 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.

Output

For each test case, print the smallest number of sheets needed to print every 'X', one per line.