#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 12;
int n, m, t;
int tp, tu, td;
int hei[maxn][maxn];
int psl[maxn][maxn], psr[maxn][maxn], pst[maxn][maxn], psb[maxn][maxn];
int calt(int pre, int now) {
  if (pre == now) return tp;
  if (pre < now) return tu;
  return td;
}
inline int qabs(int a) { return (a > 0) ? (a) : (-a); }
int main() {
  scanf("%d%d%d", &n, &m, &t);
  scanf("%d%d%d", &tp, &tu, &td);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", &hei[i][j]);
  memset(psl, 0, sizeof(psl));
  memset(psr, 0, sizeof(psr));
  memset(pst, 0, sizeof(pst));
  memset(psb, 0, sizeof(psb));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (j) {
        psl[i][j] = psl[i][j - 1] + calt(hei[i][j - 1], hei[i][j]);
        psr[i][j] = psr[i][j - 1] + calt(hei[i][j], hei[i][j - 1]);
      }
      if (i) {
        pst[j][i] = pst[j][i - 1] + calt(hei[i - 1][j], hei[i][j]);
        psb[j][i] = psb[j][i - 1] + calt(hei[i][j], hei[i - 1][j]);
      }
    }
  int rx1 = 0, ry1 = 0, rx2 = 2, ry2 = 2;
  int ans = psl[0][2] + psr[1][2] + pst[1][2] + psb[0][2];
  for (int i = 0; i < n; ++i)
    for (int j = i + 2; j < n; ++j) {
      map<int, int> M;
      for (int k = 1; k < m; ++k) {
        int hans = psl[i][k] + psr[j][k] + pst[k][j] - pst[k][i];
        map<int, int>::iterator it = M.lower_bound(t - hans);
        if (it != M.end()) {
          int tans = it->first + hans;
          if (qabs(tans - t) < qabs(ans - t)) {
            ans = tans;
            rx1 = i;
            rx2 = j;
            ry1 = it->second;
            ry2 = k;
          }
        }
        if (it != M.begin()) {
          it--;
          int tans = it->first + hans;
          if (qabs(tans - t) < qabs(ans - t)) {
            ans = tans;
            rx1 = i;
            rx2 = j;
            ry1 = it->second;
            ry2 = k;
          }
        }
        M[psb[k - 1][j] - psb[k - 1][i] - psl[i][k - 1] - psr[j][k - 1]] =
            k - 1;
      }
    }
  printf("%d %d %d %d\n", rx1 + 1, ry1 + 1, rx2 + 1, ry2 + 1);
  return 0;
}
