#include <bits/stdc++.h>
using namespace std;
const int MAXN = 305;
int n, m, t, tp, tu, td, h[MAXN][MAXN];
int r[MAXN][MAXN], rr[MAXN][MAXN], c[MAXN][MAXN], rc[MAXN][MAXN];
void pre() {
  for (int i = 1; i <= n; i++) {
    r[i][1] = 0;
    for (int j = 2; j <= m; j++) {
      int delta = 0;
      if (h[i][j] > h[i][j - 1]) delta = tu;
      if (h[i][j] == h[i][j - 1]) delta = tp;
      if (h[i][j] < h[i][j - 1]) delta = td;
      r[i][j] = r[i][j - 1] + delta;
    }
    rr[i][n] = 0;
    for (int j = m - 1; j >= 1; j--) {
      int delta = 0;
      if (h[i][j] > h[i][j + 1]) delta = tu;
      if (h[i][j] == h[i][j + 1]) delta = tp;
      if (h[i][j] < h[i][j + 1]) delta = td;
      rr[i][j] = rr[i][j + 1] + delta;
    }
  }
  for (int j = 1; j <= m; j++) {
    c[1][j] = 0;
    for (int i = 2; i <= n; i++) {
      int delta = 0;
      if (h[i][j] > h[i - 1][j]) delta = tu;
      if (h[i][j] == h[i - 1][j]) delta = tp;
      if (h[i][j] < h[i - 1][j]) delta = td;
      c[i][j] = c[i - 1][j] + delta;
    }
    rc[n][j] = 0;
    for (int i = n - 1; i >= 1; i--) {
      int delta = 0;
      if (h[i][j] > h[i + 1][j]) delta = tu;
      if (h[i][j] == h[i + 1][j]) delta = tp;
      if (h[i][j] < h[i + 1][j]) delta = td;
      rc[i][j] = rc[i + 1][j] + delta;
    }
  }
}
int tabs(int x) { return (x >= 0) ? x : -x; }
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &t, &tp, &tu, &td);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &h[i][j]);
  pre();
  int resx = -1, resy = -1, resi = -1, resj = -1, res = t + 1;
  for (int x = 1; x <= n; x++)
    for (int y = 1; y <= m; y++) {
      for (int i = x + 2; i <= n; i++)
        for (int j = y + 2; j <= m; j++) {
          int p = r[x][j] - r[x][y] + rr[i][y] - rr[i][j] + c[i][j] - c[x][j] +
                  rc[x][y] - rc[i][y];
          p = tabs(p - t);
          if (p < res) {
            res = p;
            resx = x;
            resy = y;
            resi = i;
            resj = j;
            if (res == 0) {
              printf("%d %d %d %d\n", resx, resy, resi, resj);
              return 0;
            }
          }
        }
    }
  printf("%d %d %d %d\n", resx, resy, resi, resj);
  return 0;
}
