#include <bits/stdc++.h>
using namespace std;
const int N = 333;
int n, m, t, tp, tu, td;
int x11, y11, x2, y2;
int a[N][N];
long long ans;
long long pre[N][N][4];
inline void upd(long long x, int i, int j, int a, int b) {
  if (!ans || abs(x - t) < abs(ans - t)) {
    ans = x;
    x11 = i;
    x2 = j;
    y11 = a;
    y2 = b;
  }
}
inline int calc(int x, int y) {
  if (x == y) return tp;
  if (x > y) return tu;
  return td;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n >> m >> t;
  cin >> tp >> tu >> td;
  for (int i = (1); i < (n + 1); i++)
    for (int j = (1); j < (m + 1); j++) cin >> a[i][j];
  for (int i = (1); i < (n + 1); i++)
    for (int j = (2); j < (m + 1); j++)
      pre[i][j][0] = pre[i][j - 1][0] + calc(a[i][j], a[i][j - 1]);
  for (int i = (1); i < (n + 1); i++)
    for (int j = (1); j < (m); j++)
      pre[i][j][2] = pre[i][j - 1][2] + calc(a[i][j], a[i][j + 1]);
  for (int j = (1); j < (m + 1); j++)
    for (int i = (2); i < (n + 1); i++)
      pre[i][j][1] = pre[i - 1][j][1] + calc(a[i][j], a[i - 1][j]);
  for (int j = (1); j < (m + 1); j++)
    for (int i = (1); i < (n); i++)
      pre[i][j][3] = pre[i - 1][j][3] + calc(a[i][j], a[i + 1][j]);
  for (int i = (1); i < (n + 1); i++)
    for (int j = (i + 2); j < (n + 1); j++) {
      set<pair<long long, int> > s;
      for (int k = (1); k < (m + 1); k++) {
        if (k - 2 >= 1) {
          int c = k - 2;
          long long t = -pre[i][c][0] - pre[j][c - 1][2] + pre[j - 1][c][3] -
                        pre[i - 1][c][3];
          s.insert(make_pair(t, c));
        }
        if (!s.empty()) {
          long long res =
              pre[i][k][0] + pre[j][k - 1][2] + pre[j][k][1] - pre[i][k][1];
          long long c = t - res;
          auto tmp = s.lower_bound(make_pair(c, 0));
          if (tmp != s.end()) {
            upd(res + tmp->first, i, j, tmp->second, k);
          }
          if (tmp != s.begin()) {
            tmp--;
            upd(res + tmp->first, i, j, tmp->second, k);
          }
        }
      }
    }
  cout << x11 << " " << y11 << " " << x2 << " " << y2 << "\n";
  return 0;
}
