#include <bits/stdc++.h>
using namespace std;
int row[310][310], rowsR[310][310], col[310][310], colsR[310][310],
    mat[310][310], n, m, tu, td, tr, t, to, lx, ly, rx, ry, maxy;
int main() {
  maxy = 1000 * 1000 * 1000;
  scanf("%d%d%d%d%d%d\n", &n, &m, &t, &tr, &tu, &td);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) scanf("%d", &mat[i][j]);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      row[i][j] = row[i][j - 1];
      if (j == 1)
        row[i][1] = 0;
      else if (mat[i][j] > mat[i][j - 1])
        row[i][j] += tu;
      else if (mat[i][j] < mat[i][j - 1])
        row[i][j] += td;
      else
        row[i][j] += tr;
    }
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= n; ++j) {
      col[j][i] = col[j - 1][i];
      if (j == 1)
        col[j][i] = 0;
      else if (mat[j][i] > mat[j - 1][i])
        col[j][i] += tu;
      else if (mat[j][i] < mat[j - 1][i])
        col[j][i] += td;
      else
        col[j][i] += tr;
    }
  for (int i = 1; i <= n; ++i)
    for (int j = m; j >= 1; --j) {
      rowsR[i][j] = rowsR[i][j + 1];
      if (j == m)
        rowsR[i][m] = 0;
      else if (mat[i][j] > mat[i][j + 1])
        rowsR[i][j] += tu;
      else if (mat[i][j] < mat[i][j + 1])
        rowsR[i][j] += td;
      else
        rowsR[i][j] += tr;
    }
  for (int i = 1; i <= m; ++i)
    for (int j = n; j >= 1; --j) {
      colsR[j][i] = colsR[j + 1][i];
      if (j == n)
        colsR[j][i] = 0;
      else if (mat[j][i] > mat[j + 1][i])
        colsR[j][i] += tu;
      else if (mat[j][i] < mat[j + 1][i])
        colsR[j][i] += td;
      else
        colsR[j][i] += tr;
    }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      for (int k = i + 2; k <= n; ++k)
        for (int l = j + 2; l <= m; ++l) {
          to = row[i][l] - row[i][j];
          to += col[k][l] - col[i][l];
          to += rowsR[k][j] - rowsR[k][l];
          to += colsR[i][j] - colsR[k][j];
          if (abs(to - t) < maxy) {
            maxy = abs(to - t);
            lx = i;
            ly = j;
            rx = k;
            ry = l;
          }
        }
  printf("%d %d %d %d", lx, ly, rx, ry);
  return 0;
}
