#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3F3F3F3F;
const int NEGINF = 0xC0C0C0C0;
const double EPS = 1e-8;
int cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
int tp, tu, td;
int f(int x, int y) {
  if (x == y) return tp;
  if (x < y) return tu;
  return td;
}
int main() {
  int n, m, t;
  scanf("%d %d %d", &n, &m, &t);
  scanf("%d %d %d", &tp, &tu, &td);
  vector<vector<int>> board(n, vector<int>(m));
  for (auto &x : board)
    for (auto &y : x) scanf("%d", &y);
  vector<vector<int>> cu(n + 1, vector<int>(m + 1)),
      cd(n + 1, vector<int>(m + 1)), rl(n + 1, vector<int>(m + 1)),
      rr(n + 1, vector<int>(m + 1));
  for (decltype(0) j = (0); j < (m); ++j)
    for (decltype(2) i = (2); i < (n + 1); ++i)
      cu[i][j] = cu[i - 1][j] + f(board[i - 1][j], board[i - 2][j]);
  for (decltype(0) j = (0); j < (m); ++j)
    for (decltype(2) i = (2); i < (n + 1); ++i)
      cd[i][j] = cd[i - 1][j] + f(board[i - 2][j], board[i - 1][j]);
  for (decltype(0) i = (0); i < (n); ++i)
    for (decltype(2) j = (2); j < (m + 1); ++j)
      rl[i][j] = rl[i][j - 1] + f(board[i][j - 1], board[i][j - 2]);
  for (decltype(0) i = (0); i < (n); ++i)
    for (decltype(2) j = (2); j < (m + 1); ++j)
      rr[i][j] = rr[i][j - 1] + f(board[i][j - 2], board[i][j - 1]);
  int ans = 0x7fffffff;
  int A[4];
  for (decltype(0) startrow = (0); startrow < (n); ++startrow)
    for (decltype(startrow + 3) endrow = (startrow + 3); endrow < (n + 1);
         ++endrow) {
      set<pair<int, int>> S;
      S.insert(make_pair(cu[endrow][0] - cu[startrow + 1][0], 0));
      for (decltype(3) endcol = (3); endcol < (m + 1); ++endcol) {
        int t2 = rr[startrow][endcol] + rl[endrow - 1][endcol] +
                 cd[endrow][endcol - 1] - cd[startrow + 1][endcol - 1];
        auto it = S.lower_bound(make_pair(t - t2, -1));
        auto f = [&]() {
          ans = t2 + it->first;
          A[0] = startrow + 1;
          A[2] = endrow;
          A[1] = it->second + 1;
          A[3] = endcol;
        };
        if (it != S.begin()) it--;
        if (abs(t - (t2 + it->first)) < abs(t - ans)) f();
        if (it != S.end()) it++;
        if (it != S.end())
          if (abs(t - (t2 + it->first)) < abs(t - ans)) f();
        if (it != S.end()) it++;
        if (it != S.end())
          if (abs(t - (t2 + it->first)) < abs(t - ans)) f();
        S.insert(
            make_pair(cu[endrow][endcol - 2] - cu[startrow + 1][endcol - 2] -
                          rr[startrow][endcol - 1] - rl[endrow - 1][endcol - 1],
                      endcol - 2));
      }
    }
  printf("%d %d %d %d\n", A[0], A[1], A[2], A[3]);
  return 0;
}
