#include <bits/stdc++.h>
using namespace std;
pair<int, int> a, b;
int ans = INT_MAX;
int derecha[301][301];
int izquierda[301][301];
int up[301][301];
int down[301][301];
int ground[301][301];
int distFila(int, int, int);
int distColumna(int, int, int);
int tp, tu, td;
int to(int h1, int h2) {
  if (h1 == h2) return tp;
  if (h1 < h2) return tu;
  return td;
}
int main() {
  int N, M;
  int T;
  scanf("%d %d %d\n", &N, &M, &T);
  scanf("%d %d %d\n", &tp, &tu, &td);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      scanf("%d", ground[i] + j);
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (j == 0) {
        derecha[i][j] = 0;
      } else {
        derecha[i][j] = derecha[i][j - 1] + to(ground[i][j - 1], ground[i][j]);
      }
    }
    for (int j = M - 1; j >= 0; j--) {
      if (j == M - 1) {
        izquierda[i][j] = 0;
      } else {
        izquierda[i][j] =
            izquierda[i][j + 1] + to(ground[i][j + 1], ground[i][j]);
      }
    }
  }
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      if (j == 0) {
        down[i][j] = 0;
      } else {
        down[i][j] = down[i][j - 1] + to(ground[j - 1][i], ground[j][i]);
      }
    }
    for (int j = N - 1; j >= 0; j--) {
      if (j == N - 1) {
        up[i][j] = 0;
      } else {
        up[i][j] = up[i][j + 1] + to(ground[j + 1][i], ground[j][i]);
      }
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = i + 2; j < N; j++) {
      set<pair<int, int> > derecha;
      for (int L = M - 3; L >= 0; L--) {
        derecha.insert(
            make_pair((distFila(i, 0, L + 2) + distColumna(L + 2, i, j) +
                       distFila(j, L + 2, 0)),
                      (L + 2)));
        int tmp = -distColumna(L, j, i) + distFila(i, 0, L) + distFila(j, L, 0);
        int buscar = T + tmp;
        set<pair<int, int> >::iterator it =
            derecha.lower_bound(make_pair((buscar), (0)));
        if (it != derecha.begin()) {
          it--;
        }
        for (int k = 0; k < 2 and it != derecha.end(); it++, k++) {
          int finalValue = abs(((*it).first) - tmp - T);
          if (finalValue < ans) {
            ans = finalValue;
            a = make_pair((i), (L));
            b = make_pair((j), ((*it).second));
          }
        }
      }
    }
  }
  printf("%d %d %d %d\n", a.first + 1, a.second + 1, b.first + 1, b.second + 1);
  return 0;
}
int distFila(int fila, int c1, int c2) {
  if (c1 < c2) {
    return derecha[fila][c2] - derecha[fila][c1];
  } else {
    return izquierda[fila][c2] - izquierda[fila][c1];
  }
}
int distColumna(int columna, int f1, int f2) {
  if (f1 < f2) {
    return down[columna][f2] - down[columna][f1];
  } else {
    return up[columna][f2] - up[columna][f1];
  }
}
