#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 62;
const int mods = 1e9 + 7;
const int MAXN = 200005;
const int INF = 0x3f3f3f3f;
inline int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
set<pair<int, int> > Set;
int n, m, t, cp, cu, cd, a[305][305], D[305][305], U[305][305], X1, Y1, X2, Y2;
int get(int x, int y) {
  if (x == y) return cp;
  if (x > y) return cu;
  if (x < y) return cd;
}
signed main() {
  n = read(), m = read(), t = read(), cp = read(), cu = read(), cd = read();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) a[i][j] = read();
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= m; j++)
      D[i][j] = D[i - 1][j] + get(a[i][j], a[i - 1][j]);
  for (int i = n - 1; i >= 1; i--)
    for (int j = 1; j <= m; j++)
      U[i][j] = U[i + 1][j] + get(a[i][j], a[i + 1][j]);
  int ans = INF;
  for (int i = 1; i <= n; i++)
    for (int j = i + 2; j <= n; j++) {
      int sum = 0;
      Set.clear();
      for (int k = 2; k <= m; k++) {
        int p = sum + get(a[i][k], a[i][k - 1]) + get(a[j][k - 1], a[j][k]);
        if (k > 2) {
          int y = D[j][k] - D[i][k];
          set<pair<int, int> >::iterator it =
              Set.lower_bound(make_pair(t - y - p, 0));
          if (it != Set.end() && upmin(ans, abs(t - (*it).first - y - p)))
            X1 = i, Y1 = (*it).second, X2 = j, Y2 = k;
          if (it != Set.begin()) {
            it--;
            if (upmin(ans, abs(t - (*it).first - y - p)))
              X1 = i, Y1 = (*it).second, X2 = j, Y2 = k;
          }
        }
        Set.insert(make_pair(U[i][k - 1] - U[j][k - 1] - sum, k - 1));
        sum = p;
      }
    }
  printf("%d %d %d %d\n", X1, Y1, X2, Y2);
  return 0;
}
