#include <bits/stdc++.h>
using namespace std;
const int N = 300 + 7;
const int M = 1000;
const int inf = 1e9 + 7;
const long long base = 1e18;
const double pi = acos(-1);
const double ep = 1e-9;
int n, m;
int a[N][N];
int t, tu, td, tp;
set<pair<int, int> > st;
int F[N][N], L[N][N];
int p[3];
int get(int u, int v) {
  if (u == v)
    return p[1];
  else if (u < v)
    return p[0];
  else
    return p[2];
}
int main() {
  cin >> n >> m >> t;
  cin >> p[1] >> p[0] >> p[2];
  for (int i = (int)1; i < (int)n + 1; i++) {
    for (int j = (int)1; j < (int)m + 1; j++) scanf("%d", &a[i][j]);
  }
  for (int i = (int)1; i < (int)n + 1; i++) {
    F[i][1] = 0;
    for (int j = (int)2; j < (int)m + 1; j++) {
      F[i][j] = F[i][j - 1] + get(a[i][j - 1], a[i][j]);
    }
    L[i][m] = 0;
    for (int j = m - 1; j > 0; j--) {
      L[i][j] = L[i][j + 1] + get(a[i][j + 1], a[i][j]);
    }
  }
  int tol = 0;
  int ans = inf;
  int lx, ly, rx, ry;
  for (int l = (int)1; l < (int)m + 1; l++) {
    for (int r = (int)l + 2; r < (int)m + 1; r++) {
      st.clear();
      tol = get(a[1][r], a[2][r]) + get(a[2][l], a[1][l]);
      st.insert(make_pair(F[1][r] - F[1][l], 1));
      for (int j = (int)3; j < (int)n + 1; j++) {
        int cur = L[j][l] - L[j][r];
        int pls = get(a[j - 1][r], a[j][r]) + get(a[j][l], a[j - 1][l]);
        tol += pls;
        __typeof(st.begin()) it = st.lower_bound(make_pair(t - cur - tol, 0));
        if (it != st.end() && abs(cur + tol + (it->first) - t) < ans) {
          ans = abs(cur + tol + (it->first) - t);
          lx = (it->second);
          ly = l;
          rx = j;
          ry = r;
        }
        if (it != st.begin()) it--;
        if (it != st.end() && abs(cur + tol + (it->first) - t) < ans) {
          ans = abs(cur + tol + (it->first) - t);
          lx = (it->second);
          ly = l;
          rx = j;
          ry = r;
        }
        st.insert(make_pair(F[j - 1][r] - F[j - 1][l] - tol + pls, j - 1));
      }
    }
  }
  cout << lx << " " << ly << " " << rx << " " << ry;
}
