#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int a[305][305];
int u[305][305];
int d[305][305];
int lf[305][305];
int r[305][305];
int mn = -1;
int p1, p2, p3, p4;
int main() {
  int n, m, t;
  int tp, tu, td;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &t);
  scanf("%d", &tp);
  scanf("%d", &tu);
  scanf("%d", &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++) {
    int tm = 0;
    for (int j = 2; j <= m; j++) {
      if (a[i][j] > a[i][j - 1])
        tm += tu;
      else if (a[i][j] < a[i][j - 1])
        tm += td;
      else if (a[i][j] == a[i][j - 1])
        tm += tp;
      r[i][j] = tm;
    }
  }
  for (int i = 1; i <= n; i++) {
    int tm = 0;
    for (int j = m - 1; j >= 1; j--) {
      if (a[i][j] > a[i][j + 1])
        tm += tu;
      else if (a[i][j] < a[i][j + 1])
        tm += td;
      else if (a[i][j] == a[i][j + 1])
        tm += tp;
      lf[i][j] = tm;
    }
  }
  for (int j = 1; j <= m; j++) {
    int tm = 0;
    for (int i = 2; i <= n; i++) {
      if (a[i][j] > a[i - 1][j])
        tm += tu;
      else if (a[i][j] < a[i - 1][j])
        tm += td;
      else if (a[i][j] == a[i - 1][j])
        tm += tp;
      d[i][j] = tm;
    }
  }
  for (int j = 1; j <= m; j++) {
    int tm = 0;
    for (int i = n - 1; i >= 1; i--) {
      if (a[i][j] > a[i + 1][j])
        tm += tu;
      else if (a[i][j] < a[i + 1][j])
        tm += td;
      else if (a[i][j] == a[i + 1][j])
        tm += tp;
      u[i][j] = tm;
    }
  }
  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++) {
          int tmp_t = r[i][l] - r[i][j] + d[k][l] - d[i][l] + lf[k][j] -
                      lf[k][l] + u[i][j] - u[k][j];
          int diff = abs(t - tmp_t);
          if (mn == -1) {
            mn = diff;
            p1 = i, p2 = j, p3 = k, p4 = l;
          }
          if (mn > diff) {
            mn = diff;
            p1 = i, p2 = j, p3 = k, p4 = l;
            if (mn == 0) {
              cout << p1 << ' ' << p2 << ' ' << p3 << ' ' << p4 << endl;
              return 0;
            }
          }
        }
      }
    }
  }
  cout << p1 << ' ' << p2 << ' ' << p3 << ' ' << p4 << endl;
  return 0;
}
