#include <bits/stdc++.h>
int a[303][303];
int lr[303][303];
int rl[303][303];
int tb[303][303];
int bt[303][303];
int ans = -1, afx, afy, atx, aty;
int t;
inline int calc(int fx, int fy, int tx, int ty) {
  int v1 = lr[fx][ty] - lr[fx][fy];
  int v2 = tb[tx][ty] - tb[fx][ty];
  int v3 = rl[tx][fy] - rl[tx][ty];
  int v4 = bt[fx][fy] - bt[tx][fy];
  return v1 + v2 + v3 + v4;
}
inline void ff(int fx, int fy, int tx, int ty, int tot) {
  int val = abs(tot - t);
  if (ans == -1 || val < ans) {
    ans = val;
    afx = fx;
    afy = fy;
    atx = tx;
    aty = ty;
  }
}
int main() {
  int n, m;
  scanf("%d %d %d", &n, &m, &t);
  int tp, tu, td;
  scanf("%d %d %d", &tp, &tu, &td);
  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 = 2; j <= m; ++j) {
      lr[i][j] = lr[i][j - 1];
      if (a[i][j] > a[i][j - 1])
        lr[i][j] += tu;
      else if (a[i][j] < a[i][j - 1])
        lr[i][j] += td;
      else
        lr[i][j] += tp;
    }
    for (int j = m - 1; j >= 1; --j) {
      rl[i][j] = rl[i][j + 1];
      if (a[i][j] > a[i][j + 1])
        rl[i][j] += tu;
      else if (a[i][j] < a[i][j + 1])
        rl[i][j] += td;
      else
        rl[i][j] += tp;
    }
  }
  for (int j = 1; j <= m; ++j) {
    for (int i = 2; i <= n; ++i) {
      tb[i][j] = tb[i - 1][j];
      if (a[i][j] > a[i - 1][j])
        tb[i][j] += tu;
      else if (a[i][j] < a[i - 1][j])
        tb[i][j] += td;
      else
        tb[i][j] += tp;
    }
    for (int i = n - 1; i >= 1; --i) {
      bt[i][j] = bt[i + 1][j];
      if (a[i][j] > a[i + 1][j])
        bt[i][j] += tu;
      else if (a[i][j] < a[i + 1][j])
        bt[i][j] += td;
      else
        bt[i][j] += tp;
    }
  }
  for (int i = 1; i <= m; ++i)
    for (int j = i + 2; j <= m; ++j) {
      std::set<std::pair<int, int> > st;
      int diff = 0;
      for (int k = 3; k <= n; ++k) {
        diff += (rl[k][i] - rl[k][j]) - (rl[k - 1][i] - rl[k - 1][j]) +
                (tb[k][j] - tb[k - 1][j]) + (bt[k - 1][i] - bt[k][i]);
        int val = calc(k - 2, i, k, j) - diff;
        int xt = t - diff;
        st.insert(std::pair<int, int>(val, k - 2));
        std::set<std::pair<int, int> >::iterator il =
            st.lower_bound(std::pair<int, int>(xt, 0));
        if (il != st.end()) ff(il->second, i, k, j, il->first + diff);
        std::set<std::pair<int, int> >::iterator ir =
            st.upper_bound(std::pair<int, int>(xt, 0));
        if (ir != st.begin()) --ir, ff(ir->second, i, k, j, ir->first + diff);
      }
    }
  printf("%d %d %d %d", afx, afy, atx, aty);
}
