UFO#7472

UFO

2 seconds
64 megabytes
Medium

Earth security agency needs to destroy enemy alien spaceship. They already damaged it and forced it to land in a desert. Spaceship is built of unit cube blocks and the bottom layer has the form of a n \times m rectangle. Top view of the n = 4, m = 8 spaceship shown in the figure.

![prb7472.gif](https://static.e-olymp.com/content/de/de50b1ef3d4c1d3f6719298bd064ac89d85c7b80.gif)

Spaceship blocks are built from extra-strong metal, that's why lasers are used for destroying the ship. Laser guns were established by four sides of the spaceship, and they periodically shot laser rays into some blocks of the ship (rays are always perpendicular to the spaceship sides). Each ray destroys first blocks on its way. If there is one or more blocks atop the destroyed block, they move down.

After shots it was decided to make an airstrike. For the airstrike it makes sense to choose such area of the ship of size p \times p which contains maximal possible number of whole undestroyed blocks. The airstrike will destroy all blocks in this area. Write a program, which calculates the maximal number of whole undestroyed blocks in the area of size p \times p which can be destroyed by airstrike.

Input

The first line contains integers: , (1 \leq n \cdot m \leq 1\,000\,000), (0 < r \leq 10), (0 < k \leq 300\,000) and (0 < p \leq \min(n, m, 10)). Each of the next lines contain numbers. Number in -th row and -th column is the number of blocks in the corresponding part of the ship (see a figure). Each number is in range 1 \ldots 10^6.

Next lines contain description of laser shots. Each of these lines contain one symbol and two integers (all separated by spaces). Symbol defines the side of the shot: "W" - west, "E" - east, "S" - south, "N" - north. First integer is the number of row (in case of west or east), or the number of column (in case of north and south), and second number is the height of the shot. Rows and columns numbers correspond to numeration of input data, layers are numbered from one. Each number is in range 1 \ldots 10^6.

Output

Output maximal number of undestroyed blocks after laser shots in the area of size p \times p.

Examples

Example 1

Loading
Loading

Note

![prb7472_1.gif](https://static.e-olymp.com/content/27/27366e2c59efdc463763a5403ccf4bb1ac35812f.gif)

In the figure it's shown spaceship from the figure after laser shots from example.