Problem: 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 h2 to h1 (h1 ≤ h2) they need to remove h2 - h1 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? 

Input

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 109. 

Output

In the first line output k — the amount of constructed cities. In each of the following k lines output 3 space-separated numbers — the row number and the column number of the upper-left corner of a subsequent construction site, and the amount of the ground to remove from it. Output the sites in the order of their building up.

Examples

Input

2 2 1 2
1 2
3 5


Output

2
1 1 1
2 1 2


Input

4 4 2 2
1 5 3 4
2 7 6 1
1 1 2 2
2 2 1 2


Output

3
3 1 2
3 3 3
1 2 9

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
void __never(int a) { printf("\nOPS %d", a); }
int n, m, A, B;
int M[1024][1024];
long long S[1024][1024];
int minH[1024][1024];
long long dp1[1024][1024];
int dp2[1024][1024];
int T[1024][1024];
pair<long long, pair<int, int> > S2[1024 * 1024];
int s2sz = 0;
bool F[1024 * 1024];
void xset(int x, int y) {
  for (int a = x; a <= n; a |= (a + 1))
    for (int b = y; b <= m; b |= (b + 1)) T[a][b]++;
}
int xget(int x, int y) {
  int re = 0;
  for (int a = x; a >= 0; a = (a & (a + 1)) - 1)
    for (int b = y; b >= 0; b = (b & (b + 1)) - 1) re += T[a][b];
  return re;
}
void sol() {
  multiset<int> Set;
  for (int a = (1); a <= (n); a++) {
    Set.clear();
    for (int b = (1); b <= (m); b++) {
      Set.insert(M[a][b]);
      if ((int)((Set).size()) > B) Set.erase(Set.find(M[a][b - B]));
      if ((int)((Set).size()) == B) minH[a][b] = (*Set.begin());
    }
  }
  for (int b = (1); b <= (m); b++) {
    Set.clear();
    for (int a = (1); a <= (n); a++) {
      Set.insert(minH[a][b]);
      if ((int)((Set).size()) > A) Set.erase(Set.find(minH[a - A][b]));
      if ((int)((Set).size()) == A) dp2[a][b] = (*Set.begin());
    }
  }
  for (int a = (1); a <= (n); a++)
    for (int b = (1); b <= (m); b++)
      S[a][b] = S[a - 1][b] + S[a][b - 1] - S[a - 1][b - 1] + M[a][b];
  for (int a = (A); a <= (n); a++)
    for (int b = (B); b <= (m); b++)
      dp1[a][b] = S[a][b] - S[a - A][b] - S[a][b - B] + S[a - A][b - B];
  for (int a = (A); a <= (n); a++)
    for (int b = (B); b <= (m); b++)
      S2[s2sz++] = (make_pair(
          dp1[a][b] - (long long)dp2[a][b] * (long long)A * (long long)B,
          make_pair(a, b)));
  sort(S2, S2 + s2sz);
  int ans = 0;
  for (int i = (0); i <= (s2sz - 1); i++) {
    int x = S2[i].second.first;
    int y = S2[i].second.second;
    if (xget(x, y) - xget(x - A, y) - xget(x, y - B) + xget(x - A, y - B) ==
        0) {
      ans++;
      F[i] = true;
      for (int a = (x - A + 1); a <= (x); a++)
        for (int b = (y - B + 1); b <= (y); b++) xset(a, b);
    }
  }
  printf("%d\n", ans);
  for (int a = (0); a <= (s2sz - 1); a++)
    if (F[a]) {
      int x = S2[a].second.first;
      int y = S2[a].second.second;
      long long ea = S2[a].first;
      printf("%d %d %lld\n", x - A + 1, y - B + 1, ea);
    }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &A, &B);
  for (int a = (1); a <= (n); a++)
    for (int b = (1); b <= (m); b++) scanf("%d", &M[a][b]);
  sol();
  return 0;
}