#include <bits/stdc++.h>
using namespace std;
int n, m;
int tNeed, tPlain, tUp, tDown;
int h[303][303];
int sums1[303][303][303];
int sums2[303][303][303];
int prefRowsLeft[303][303];
int prefRowsRight[303][303];
int prefColsDown[303][303];
int prefColsUp[303][303];
set<pair<int, int> > s;
void precalcPrefSums() {
  for (int r = 1; r <= n; r++) {
    for (int c = 2; c <= m; c++) {
      int val = prefRowsRight[r][c - 1];
      if (h[r][c - 1] < h[r][c]) {
        val += tUp;
      } else if (h[r][c - 1] > h[r][c]) {
        val += tDown;
      } else {
        val += tPlain;
      }
      prefRowsRight[r][c] = val;
    }
  }
  for (int r = 1; r <= n; r++) {
    for (int c = m - 1; c >= 1; c--) {
      int val = prefRowsLeft[r][c + 1];
      if (h[r][c + 1] < h[r][c]) {
        val += tUp;
      } else if (h[r][c + 1] > h[r][c]) {
        val += tDown;
      } else {
        val += tPlain;
      }
      prefRowsLeft[r][c] = val;
    }
  }
  for (int c = 1; c <= m; c++) {
    for (int r = 2; r <= n; r++) {
      int val = prefColsDown[c][r - 1];
      if (h[r - 1][c] < h[r][c]) {
        val += tUp;
      } else if (h[r - 1][c] > h[r][c]) {
        val += tDown;
      } else {
        val += tPlain;
      }
      prefColsDown[c][r] = val;
    }
  }
  for (int c = 1; c <= m; c++) {
    for (int r = n - 1; r >= 1; r--) {
      int val = prefColsUp[c][r + 1];
      if (h[r + 1][c] < h[r][c]) {
        val += tUp;
      } else if (h[r + 1][c] > h[r][c]) {
        val += tDown;
      } else {
        val += tPlain;
      }
      prefColsUp[c][r] = val;
    }
  }
}
int getSumLeft(int r, int c1, int c2) {
  return prefRowsLeft[r][c1] - prefRowsLeft[r][c2];
}
int getSumRight(int r, int c1, int c2) {
  return prefRowsRight[r][c2] - prefRowsRight[r][c1];
}
int getSumDown(int c, int r1, int r2) {
  return prefColsDown[c][r2] - prefColsDown[c][r1];
}
int getSumUp(int c, int r1, int r2) {
  return prefColsUp[c][r1] - prefColsUp[c][r2];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> tNeed;
  cin >> tPlain >> tUp >> tDown;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> h[i][j];
    }
  }
  precalcPrefSums();
  for (int r1 = 1; r1 <= n; r1++) {
    for (int r2 = r1 + 2; r2 <= n; r2++) {
      for (int c1 = 1; c1 <= m - 2; c1++) {
        sums1[r1][r2][c1] = getSumLeft(r2, c1, m) + getSumUp(c1, r1, r2) +
                            getSumRight(r1, c1, m);
      }
    }
  }
  for (int r1 = 1; r1 <= n; r1++) {
    for (int r2 = r1 + 2; r2 <= n; r2++) {
      for (int c2 = 3; c2 <= m; c2++) {
        sums2[r1][r2][c2] = -getSumLeft(r2, c2, m) + getSumDown(c2, r1, r2) -
                            getSumRight(r1, c2, m);
      }
    }
  }
  int bestR1 = -1, bestR2 = -1;
  int bestC1 = -1, bestC2 = -1;
  int bestDiff = (int)1e9;
  for (int r1 = 1; r1 <= n; r1++) {
    for (int r2 = r1 + 2; r2 <= n; r2++) {
      s.clear();
      for (int c1 = 1, c2 = 3; c2 <= m; c1++, c2++) {
        s.insert(pair<int, int>(sums1[r1][r2][c1], c1));
        set<pair<int, int> >::iterator it =
            s.lower_bound(pair<int, int>(tNeed - sums2[r1][r2][c2], -999999));
        if (it != s.end()) {
          int diff = abs(tNeed - sums2[r1][r2][c2] - it->first);
          if (diff < bestDiff) {
            bestDiff = diff;
            bestR1 = r1;
            bestR2 = r2;
            bestC1 = it->second;
            bestC2 = c2;
          }
        }
        if (it != s.begin()) {
          it--;
          int diff = abs(tNeed - sums2[r1][r2][c2] - it->first);
          if (diff < bestDiff) {
            bestDiff = diff;
            bestR1 = r1;
            bestR2 = r2;
            bestC1 = it->second;
            bestC2 = c2;
          }
        }
      }
    }
  }
  cout << bestR1 << " " << bestC1 << " " << bestR2 << " " << bestC2 << "\n";
}
