Fishing Contest

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

In a fishing contest, the participants fish in a lake, represented as a 2D grid of dimension r×cr \times c. Each integer point in the grid contains fish.

At point (x,y)(x, y), fish first appear at second t_x,yt\_{x, y} and disappear just before time t_x,y+kt\_{x, y} + k seconds. Outside of this time, no fish can be caught at this position. It takes no time to catch all the fish at a point, and all points contain the same amount of fish. Furthermore, moving to the point immediately north, west, south or east from the point you are currently at takes exactly 11 second.

Assume that you start at some position (x_0,y_0)(x\_0, y\_0) at second 11, and can catch fish until (and including) second ll. From how many points in the lake can you catch fish, if you travel optimally on the lake?

입력

The input consists of:

  • one line with the integers rr, cc, kk and ll (1r,c1001 \le r, c \le 100, 1k51 \le k \le 5, 1l1051 \le l \le 10^5), the dimensions of the lake, the number of seconds fish stays at a point, and the number of seconds you can catch fish.
  • one line with the integers x_0x\_0 and y_0y\_0 (0r<x_00 \le r < x\_0, 0c<y_00 \le c < y\_0), your original position.
  • rr lines, the xx'th of which contains cc integers t_x,0,,t_x,c1t\_{x, 0}, \dots, t\_{x, c - 1} (each between 11 and ll, inclusive), the times at which fish appers on points in the xx'th row.

출력

Output the maximum number of points you could catch fish from.