#include <bits/stdc++.h>
using namespace std;
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
  if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
  if (b < a) a = b;
}
const int N = 305, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
int n, m, T;
int t[3];
int a[N][N];
int gr[N][N];
int gl[N][N];
int gu[N][N];
int gd[N][N];
int tp(int x) {
  if (x == 0) return t[0];
  if (x > 0) return t[2];
  if (x < 0) return t[1];
}
int check(int y1, int x1, int y2, int x2) {
  int ret = 0;
  ret += gr[y1][x2] - gr[y1][x1];
  ret += gd[y2][x2] - gd[y1][x2];
  ret += gl[y2][x1] - gl[y2][x2];
  ret += gu[y1][x1] - gu[y2][x1];
  return ret;
}
int main() {
  while (~scanf("%d%d%d", &n, &m, &T)) {
    scanf("%d%d%d", &t[0], &t[1], &t[2]);
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= m; ++j) scanf("%d", &a[i][j]);
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        gr[i][j] = (j > 1) * (gr[i][j - 1] + tp(a[i][j - 1] - a[i][j]));
        gd[i][j] = (i > 1) * (gd[i - 1][j] + tp(a[i - 1][j] - a[i][j]));
      }
    }
    for (int i = n; i >= 1; --i) {
      for (int j = m; j >= 1; --j) {
        gl[i][j] = (j < m) * (gl[i][j + 1] + tp(a[i][j + 1] - a[i][j]));
        gu[i][j] = (i < n) * (gu[i + 1][j] + tp(a[i + 1][j] - a[i][j]));
      }
    }
    int ans = 1e9;
    int sty, stx, edy, edx;
    for (int i = 1; i <= n - 2; ++i) {
      for (int j = 1; j <= m - 2; ++j) {
        for (int y = i + 2; y <= n; ++y) {
          for (int x = j + 2; x <= m; ++x) {
            int tmp = abs(check(i, j, y, x) - T);
            if (tmp < ans) {
              ans = tmp;
              sty = i;
              stx = j;
              edy = y;
              edx = x;
            }
          }
        }
      }
    }
    printf("%d %d %d %d\n", sty, stx, edy, edx);
  }
  return 0;
}
