#include <bits/stdc++.h>
using namespace std;
const int N = 510;
struct node {
  int x, y;
} d[2];
int n, m, T, g[N][N];
int f, len, root, fa[N], size[N], son[N][2], t[4];
int a[N][N][2], b[N][N][2], dt[N], tmp, tmp2, ans;
int Abs(int x) { return x > 0 ? x : -x; }
void init() {
  int i, j;
  for (i = 1; i <= n; i++)
    for (j = 2; j <= m; j++)
      if (g[i][j] > g[i][j - 1])
        a[i][j][0] = a[i][j - 1][0] + t[1];
      else if (g[i][j] < g[i][j - 1])
        a[i][j][0] = a[i][j - 1][0] + t[2];
      else if (g[i][j] == g[i][j - 1])
        a[i][j][0] = a[i][j - 1][0] + t[0];
  for (i = 1; i <= n; i++)
    for (j = m - 1; j; j--)
      if (g[i][j] > g[i][j + 1])
        a[i][j][1] = a[i][j + 1][1] + t[1];
      else if (g[i][j] < g[i][j + 1])
        a[i][j][1] = a[i][j + 1][1] + t[2];
      else if (g[i][j] == g[i][j + 1])
        a[i][j][1] = a[i][j + 1][1] + t[0];
  for (j = 1; j <= m; j++)
    for (i = 2; i <= n; i++)
      if (g[i][j] > g[i - 1][j])
        b[i][j][0] = b[i - 1][j][0] + t[1];
      else if (g[i][j] < g[i - 1][j])
        b[i][j][0] = b[i - 1][j][0] + t[2];
      else if (g[i][j] == g[i - 1][j])
        b[i][j][0] = b[i - 1][j][0] + t[0];
  for (j = 1; j <= m; j++)
    for (i = n - 1; i; i--)
      if (g[i][j] > g[i + 1][j])
        b[i][j][1] = b[i + 1][j][1] + t[1];
      else if (g[i][j] < g[i + 1][j])
        b[i][j][1] = b[i + 1][j][1] + t[2];
      else if (g[i][j] == g[i + 1][j])
        b[i][j][1] = b[i + 1][j][1] + t[0];
}
int area(int x1, int y1, int x2, int y2) {
  int tmp = 0;
  tmp += a[x1][y2][0] - a[x1][y1][0];
  tmp += a[x2][y1][1] - a[x2][y2][1];
  tmp += b[x2][y2][0] - b[x1][y2][0];
  tmp += b[x1][y1][1] - b[x2][y1][1];
  return tmp;
}
void rotate(int x) {
  int y = fa[x], w = (son[y][0] == x);
  if (!fa[y])
    root = x;
  else
    son[fa[y]][son[fa[y]][1] == y] = x;
  fa[x] = fa[y];
  fa[y] = x;
  if (son[x][w]) fa[son[x][w]] = y;
  son[y][1 ^ w] = son[x][w];
  son[x][w] = y;
  size[y] = size[son[y][0]] + size[son[y][1]] + 1;
  size[x] = size[son[x][0]] + size[son[x][1]] + 1;
}
void ins(int i, int x) {
  if (!root) {
    dt[root = ++len] = x;
    son[root][0] = son[root][1] = 0;
    fa[root] = 0;
    size[root] = 1;
    return;
  }
  size[i]++;
  if (x <= dt[i])
    if (son[i][0])
      ins(son[i][0], x);
    else {
      son[i][0] = ++len;
      dt[len] = x;
      son[len][0] = son[len][1] = 0;
      fa[len] = i;
      size[len] = 1;
    }
  else if (son[i][1])
    ins(son[i][1], x);
  else {
    son[i][1] = ++len;
    dt[len] = x;
    son[len][0] = son[len][1] = 0;
    fa[len] = i;
    size[len] = 1;
  }
  if (size[son[i][0]] > size[son[i][1]])
    rotate(son[i][0]);
  else if (size[son[i][1]] > size[son[i][0]])
    rotate(son[i][1]);
}
void getans(int i, int x) {
  if (!i) return;
  if (Abs(x - dt[i]) < tmp2) f = i, tmp2 = Abs(x - dt[i]);
  if (dt[i] >= x)
    getans(son[i][0], x);
  else
    getans(son[i][1], x);
}
int calc(int i, int j, int l) {
  return a[i][l][0] + a[j][1][1] - a[j][l][1] - b[i][l][1] + b[j][l][1];
}
int calc2(int i, int j, int r) {
  return a[i][r][0] + a[j][1][1] - a[j][r][1] - b[i][r][0] + b[j][r][0];
}
void read(int &a) {
  char ch;
  while (!((ch = getchar()) >= '0' && ch <= '9'))
    ;
  a = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9') (a *= 10) += ch - '0';
}
int main() {
  int i, j, l, r;
  ans = 1000000000;
  read(n);
  read(m);
  read(T);
  read(t[0]);
  read(t[1]);
  read(t[2]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) read(g[i][j]);
  init();
  for (i = 1; i < n - 1; i++)
    for (j = i + 2; j <= n; j++) {
      len = root = 0;
      for (r = 3; r <= m; r++) {
        f = 0;
        tmp = calc2(i, j, r) - T;
        tmp2 = ans;
        ins(root, calc(i, j, r - 2));
        getans(root, tmp);
        if (f == -1) continue;
        if (tmp2 < ans) {
          d[0].x = i;
          d[0].y = f;
          d[1].x = j;
          d[1].y = r;
          ans = tmp2;
        }
      }
    }
  printf("%d %d %d %d\n", d[0].x, d[0].y, d[1].x, d[1].y);
  return 0;
}
