#include <bits/stdc++.h>
using namespace std;
void RI() {}
template <typename... T>
void RI(int& head, T&... tail) {
  scanf("%d", &head);
  RI(tail...);
}
int n, m, t, tp, tu, td, h[310][310];
int dpu[310], dpd[310];
int calc(int h1, int h2) {
  if (h1 < h2)
    return tu;
  else if (h1 > h2)
    return td;
  else
    return tp;
}
int main() {
  RI(n, m, t, tp, tu, td);
  for (int i = (1); i <= int(n); i++)
    for (int j = (1); j <= int(m); j++) RI(h[i][j]);
  int at = -1, ax1 = 0, ay1 = 0, ax2 = 0, ay2 = 0;
  auto upd = [&](int tt, int x1, int y1, int x2, int y2) {
    if (at != -1 && abs(t - tt) >= abs(t - at)) return;
    tie(at, ax1, ay1, ax2, ay2) = make_tuple(tt, x1, y1, x2, y2);
  };
  for (int i = (1); i <= int(n); i++) {
    memset(dpu, 0, sizeof(dpu));
    memset(dpd, 0, sizeof(dpd));
    for (int j = (i + 1); j <= int(n); j++) {
      for (int k = (1); k <= int(m); k++) dpu[k] += calc(h[j][k], h[j - 1][k]);
      for (int k = (1); k <= int(m); k++) dpd[k] += calc(h[j - 1][k], h[j][k]);
      if (j == i + 1) continue;
      int now = 0;
      set<pair<int, int> > s;
      pair<int, int> todo;
      for (int k = (1); k <= int(m); k++) {
        if (k > 1) {
          now += calc(h[i][k - 1], h[i][k]);
          now += calc(h[j][k], h[j][k - 1]);
        }
        int tr = now + dpd[k];
        auto it = s.lower_bound(make_pair(tr - t, 0));
        if (it != s.end()) upd(tr - it->first, i, it->second, j, k);
        if (it != s.begin()) {
          it--;
          upd(tr - it->first, i, it->second, j, k);
        }
        if (k >= 2) s.insert(todo);
        todo = make_pair(now - dpu[k], k);
      }
    }
  }
  printf("%d %d %d %d\n", ax1, ay1, ax2, ay2);
  return 0;
}
