There is an area map that is a rectangular matrix *n* × *m*, each cell of the matrix contains the average height of a corresponding area part. Peter works for a company that has to build several cities within this area, each of the cities will occupy a rectangle *a* × *b* cells on the map. To start construction works in a particular place Peter needs to remove excess ground from the construction site where a new city will be built. To do so he chooses a cell of the minimum height within this site, and removes excess ground from other cells of the site down to this minimum level. Let's consider that to lower the ground level from *h*<sub class="lower-index">2</sub> to *h*<sub class="lower-index">1</sub> (*h*<sub class="lower-index">1</sub> ≤ *h*<sub class="lower-index">2</sub>) they need to remove *h*<sub class="lower-index">2</sub> - *h*<sub class="lower-index">1</sub> ground units.

Let's call a site's position optimal, if the amount of the ground removed from this site is minimal compared to other possible positions. Peter constructs cities according to the following algorithm: from all the optimum site's positions he chooses the uppermost one. If this position is not unique, he chooses the leftmost one. Then he builds a city on this site. Peter repeats this process untill he can build at least one more city. For sure, he cannot carry out construction works on the occupied cells. Would you, please, help Peter place cities according to the algorithm?
The first line contains four space-separated integers: map sizes *n*, *m* and city sizes *a*, *b* (1 ≤ *a* ≤ *n* ≤ 1000, 1 ≤ *b* ≤ *m* ≤ 1000). Then there follow *n* lines, each contains *m* non-negative space-separated numbers, describing the height matrix. Each number doesn't exceed 10<sup class="upper-index">9</sup>.

import heapq

def solve():
    """
    Map each cell to the amount of ground it needs to remove to become at the level of the shortest cell.
    Priority Queue is used to efficiently search for the cell with the smallest amount of ground to remove.
    Removing a city from the map involves removing its cells from the Priority Queue and making the 
    corresponding cells in the map as occupied.
    """

    n, m, a, b = [int(i) for i in input().split()]
    h = [[int(j) for j in input().split()] for i in range(n)]
    pq = []
    q = [[[] for j in range(m)] for i in range(n)]

    rem = [[0 for j in range(m)] for i in range(n)]
    ocp = [[False for j in range(m)] for i in range(n)]
    result = []
    dx = [0]*a + [1]*a
    dy = [0]*b + [1]*b

    for i in range(n-a+1):
        for j in range(m-b+1):
            mn = min(h[i+u][j+v] for u, v in zip(dx, dy))
            rem[i][j] = sum(h[i+u][j+v] - mn for u, v in zip(dx, dy))
            q[i+a-1][j+b-1] = [(i, j)]
            heapq.heappush(pq, (rem[i][j], i+a-1, j+b-1))

    while len(pq) > 0:
        v, x, y = heapq.heappop(pq)
        while len(pq) > 0 and ocp[x][y]: v, x, y = heapq.heappop(pq)

        if not ocp[x][y]:
            for u, v in q[x][y]:
                result.append((u+1, v+1, rem[u][v]))
                for u1, v1 in [(u+i, v+j) for i in range(a) for j in range(b)]:
                    ocp[u1][v1] = True

    print(len(result))
    for i in result: print(*i)

if __name__ == "__main__":
    solve()
