#include <bits/stdc++.h>
using namespace std;
const long long N = 305, oo = 1e9;
long long Right[N][N], Left[N][N], Up[N][N], Down[N][N], a[N][N], n, res = oo,
                                                                     m, lazy[N];
long long up, down, flat, t;
pair<long long, long long> res1, res2;
long long go(long long a, long long b) {
  if (a < b) return up;
  if (a > b) return down;
  if (a == b) return flat;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> t >> flat >> up >> down;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      cin >> a[i][j];
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      if (j != 1) Right[i][j] = Right[i][j - 1] + go(a[i][j - 1], a[i][j]);
      if (j != 1) Left[i][j] = Left[i][j - 1] + go(a[i][j], a[i][j - 1]);
      if (i == 1) continue;
      Up[i][j] = Up[i - 1][j] + go(a[i][j], a[i - 1][j]);
      Down[i][j] = Down[i - 1][j] + go(a[i - 1][j], a[i][j]);
    }
  }
  for (long long c1 = 1; c1 <= m; ++c1) {
    for (long long c2 = c1 + 1; c2 <= m; ++c2)
      if (c2 - c1 > 1) {
        long long cur1, cur2;
        cur1 = cur2 = 0;
        set<pair<long long, long long> > S;
        S.clear();
        lazy[1] = Right[1][c2] - Right[1][c1];
        for (long long i = 2; i <= n; ++i) {
          cur1 = Up[i][c1], cur2 = Down[i][c2];
          long long now = Left[i][c2] - Left[i][c1];
          long long nxt = Right[i][c2] - Right[i][c1];
          set<pair<long long, long long> >::iterator it = S.lower_bound(
              pair<long long, long long>(t - cur1 - cur2 - now, 0));
          if (it != S.end()) {
            long long val = (*it).first;
            long long id = (*it).second;
            res = min(res, cur1 + cur2 + val + now - t);
            if (res == cur1 + cur2 + val + now - t) {
              if (res == 0) {
                cout << id << ' ' << c1 << ' ' << i << ' ' << c2 << endl;
                return 0;
              }
              res1 = pair<long long, long long>(id, c1);
              res2 = pair<long long, long long>(i, c2);
            }
          }
          if (it != S.begin()) {
            it--;
            long long val = (*it).first;
            long long id = (*it).second;
            res = min(res, abs(cur1 + cur2 + val + now - t));
            if (res == abs(cur1 + cur2 + val + now - t)) {
              if (res == 0) {
                cout << id << ' ' << c1 << ' ' << i << ' ' << c2 << endl;
                return 0;
              }
              res1 = pair<long long, long long>(id, c1);
              res2 = pair<long long, long long>(i, c2);
            }
          }
          lazy[i] = nxt - cur1 - cur2;
          S.insert(pair<long long, long long>(lazy[i - 1], i - 1));
        }
      }
  }
  cout << res1.first << ' ' << res1.second << ' ' << res2.first << ' '
       << res2.second << endl;
  return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.

To construct a biathlon track a plot of land was allocated, which is a rectangle divided into n × m identical squares. Each of the squares has two coordinates: the number of the row (from 1 to n), where it is located, the number of the column (from 1 to m), where it is located. Also each of the squares is characterized by its height. During the sports the biathletes will have to move from one square to another. If a biathlete moves from a higher square to a lower one, he makes a descent. If a biathlete moves from a lower square to a higher one, he makes an ascent. If a biathlete moves between two squares with the same height, then he moves on flat ground.

The biathlon track should be a border of some rectangular area of the allocated land on which biathletes will move in the clockwise direction. It is known that on one move on flat ground an average biathlete spends tp seconds, an ascent takes tu seconds, a descent takes td seconds. The Tomsk Administration wants to choose the route so that the average biathlete passes it in as close to t seconds as possible. In other words, the difference between time ts of passing the selected track and t should be minimum.

For a better understanding you can look at the first sample of the input data. In this sample n = 6, m = 7, and the administration wants the track covering time to be as close to t = 48 seconds as possible, also, tp = 3, tu = 6 and td = 2. If we consider the rectangle shown on the image by arrows, the average biathlete can move along the boundary in a clockwise direction in exactly 48 seconds. The upper left corner of this track is located in the square with the row number 4, column number 3 and the lower right corner is at square with row number 6, column number 7.

<image>

Among other things the administration wants all sides of the rectangle which boundaries will be the biathlon track to consist of no less than three squares and to be completely contained within the selected land.

You are given the description of the given plot of land and all necessary time values. You are to write the program to find the most suitable rectangle for a biathlon track. If there are several such rectangles, you are allowed to print any of them.

Input

The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time.

The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, an ascent and a descent respectively.

Then n lines follow, each line contains m integers that set the heights of each square of the given plot of land. Each of the height values is a positive integer, not exceeding 106.

Output

In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.

Examples

Input

6 7 48
3 6 2
5 4 8 3 3 7 9
4 1 6 8 7 1 1
1 6 4 6 4 8 6
7 2 6 1 6 9 4
1 9 8 6 3 9 2
4 5 6 8 4 3 7

Output

4 3 6 7

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long N = 305, oo = 1e9;
long long Right[N][N], Left[N][N], Up[N][N], Down[N][N], a[N][N], n, res = oo,
                                                                     m, lazy[N];
long long up, down, flat, t;
pair<long long, long long> res1, res2;
long long go(long long a, long long b) {
  if (a < b) return up;
  if (a > b) return down;
  if (a == b) return flat;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> t >> flat >> up >> down;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      cin >> a[i][j];
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= m; ++j) {
      if (j != 1) Right[i][j] = Right[i][j - 1] + go(a[i][j - 1], a[i][j]);
      if (j != 1) Left[i][j] = Left[i][j - 1] + go(a[i][j], a[i][j - 1]);
      if (i == 1) continue;
      Up[i][j] = Up[i - 1][j] + go(a[i][j], a[i - 1][j]);
      Down[i][j] = Down[i - 1][j] + go(a[i - 1][j], a[i][j]);
    }
  }
  for (long long c1 = 1; c1 <= m; ++c1) {
    for (long long c2 = c1 + 1; c2 <= m; ++c2)
      if (c2 - c1 > 1) {
        long long cur1, cur2;
        cur1 = cur2 = 0;
        set<pair<long long, long long> > S;
        S.clear();
        lazy[1] = Right[1][c2] - Right[1][c1];
        for (long long i = 2; i <= n; ++i) {
          cur1 = Up[i][c1], cur2 = Down[i][c2];
          long long now = Left[i][c2] - Left[i][c1];
          long long nxt = Right[i][c2] - Right[i][c1];
          set<pair<long long, long long> >::iterator it = S.lower_bound(
              pair<long long, long long>(t - cur1 - cur2 - now, 0));
          if (it != S.end()) {
            long long val = (*it).first;
            long long id = (*it).second;
            res = min(res, cur1 + cur2 + val + now - t);
            if (res == cur1 + cur2 + val + now - t) {
              if (res == 0) {
                cout << id << ' ' << c1 << ' ' << i << ' ' << c2 << endl;
                return 0;
              }
              res1 = pair<long long, long long>(id, c1);
              res2 = pair<long long, long long>(i, c2);
            }
          }
          if (it != S.begin()) {
            it--;
            long long val = (*it).first;
            long long id = (*it).second;
            res = min(res, abs(cur1 + cur2 + val + now - t));
            if (res == abs(cur1 + cur2 + val + now - t)) {
              if (res == 0) {
                cout << id << ' ' << c1 << ' ' << i << ' ' << c2 << endl;
                return 0;
              }
              res1 = pair<long long, long long>(id, c1);
              res2 = pair<long long, long long>(i, c2);
            }
          }
          lazy[i] = nxt - cur1 - cur2;
          S.insert(pair<long long, long long>(lazy[i - 1], i - 1));
        }
      }
  }
  cout << res1.first << ' ' << res1.second << ' ' << res2.first << ' '
       << res2.second << endl;
  return 0;
}

```