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>
using namespace std;
int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
const int maxn = 1e3 + 10;
const int inf = 1e9 + 10;
int dpR[maxn][maxn], dpD[maxn][maxn];
long long sumR[maxn][maxn], sumD[maxn][maxn];
int h[maxn][maxn];
bool mark[maxn][maxn];
vector<pair<long long, pair<int, int> > > st, ans;
pair<int, int> q2[maxn][maxn];
int T2[maxn], H2[maxn];
pair<int, int> q[maxn];
int H, T;
int32_t main() {
  int n = in(), m = in(), a = in(), b = in();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) h[i][j] = in();
  for (int i = n - 1; i >= 0; i--) {
    T = H = 0;
    for (int j = m - 1; j >= 0; j--) {
      while (T - H && q[T - 1].first >= h[i][j]) T--;
      q[T++] = {h[i][j], j};
      sumR[i][j] = sumR[i][j + 1] + h[i][j];
      if (j + b < m) sumR[i][j] -= h[i][j + b];
      while (q[H].second >= j + b) H++;
      dpR[i][j] = q[H].first;
      while (T2[j] - H2[j] && q2[j][T2[j] - 1].first >= dpR[i][j]) T2[j]--;
      q2[j][T2[j]++] = {dpR[i][j], i};
      while (q2[j][H2[j]].second >= i + a) H2[j]++;
      dpD[i][j] = q2[j][H2[j]].first;
      sumD[i][j] = sumR[i][j] + sumD[i + 1][j];
      if (i + a < n) {
        sumD[i][j] -= sumR[i + a][j];
      }
    }
  }
  for (int i = 0; i + a - 1 < n; i++)
    for (int j = 0; j + b - 1 < m; j++) {
      st.push_back({sumD[i][j] - 1LL * dpD[i][j] * a * b, {i, j}});
    }
  sort(st.begin(), st.end());
  for (auto x : st) {
    if (mark[x.second.first][x.second.second]) continue;
    ans.push_back(x);
    for (int I = max(x.second.first - a + 1, 0);
         I <= min(x.second.first + a - 1, n - 1); I++) {
      for (int J = max(x.second.second - b + 1, 0);
           J <= min(x.second.second + b - 1, m - 1); J++) {
        if (I + a <= n && J + b <= m && !mark[I][J]) {
          mark[I][J] = true;
        }
      }
    }
  }
  printf("%d\n", (int)ans.size());
  for (auto x : ans)
    printf("%d %d %lld\n", x.second.first + 1, x.second.second + 1, x.first);
}