#include <bits/stdc++.h>
using namespace std;
const int N = 310;
int n, m, t, tp, tu, td, sh[N][N], sn[N][N][2], sm[N][N][2];
int a[N], b[N], c[N], ans, x, y, z, h;
set<pair<int, int> > s;
inline int read() {
  int f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
inline int cal(int x, int y) { return (x == y) ? tp : (x < y) ? tu : td; }
inline void upd(int v, int a, int b, int c, int d) {
  ans = v;
  x = a;
  y = b;
  z = c;
  h = d;
}
signed main() {
  n = read();
  m = read();
  t = read();
  tp = read();
  tu = read();
  td = read();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) sh[i][j] = read();
  for (int i = 1; i <= n; i++) {
    for (int j = 2; j <= m; j++)
      sn[i][j][0] = sn[i][j - 1][0] + cal(sh[i][j - 1], sh[i][j]);
    for (int j = m - 1; j >= 1; j--)
      sn[i][j][1] = sn[i][j + 1][1] + cal(sh[i][j + 1], sh[i][j]);
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 2; i <= n; i++)
      sm[i][j][0] = sm[i - 1][j][0] + cal(sh[i - 1][j], sh[i][j]);
    for (int i = n - 1; i >= 1; i--)
      sm[i][j][1] = sm[i + 1][j][1] + cal(sh[i + 1][j], sh[i][j]);
  }
  ans = 0x3f3f3f3f;
  for (int l = 1; l <= m; l++) {
    for (int r = l + 2; r <= m; r++) {
      s.clear();
      for (int i = n - 1; i >= 1; i--) {
        int nt = t - sn[i][r][0] + sn[i][l][0] - sm[i][l][1] + sm[i][r][0];
        auto it = s.lower_bound(make_pair(nt, 0));
        if (it != s.end() && (*it).first - nt < ans)
          upd((*it).first - nt, i, l, (*it).second, r);
        if (it != s.begin()) {
          it--;
          if (nt - (*it).first < ans)
            upd(nt - (*it).first, i, l, (*it).second, r);
        }
        s.insert(make_pair(sn[i + 1][l][1] - sn[i + 1][r][1] + sm[i + 1][r][0] -
                               sm[i + 1][l][1],
                           i + 1));
      }
    }
  }
  printf("%d %d %d %d\n", x, y, z, h);
}
