#include <bits/stdc++.h>
using namespace std;
int const INF = 100 + (int)1e9;
long long const INFL = 100 + (long long)1e18;
long double const PI = 3.141592653589793238462643L;
mt19937 tw(960172);
bool is_prime(long long x) {
  for (long long y = 2; y * y <= x; ++y)
    if (x % y == 0) return 0;
  return x > 1;
}
long long rnd(long long x, long long y) {
  static uniform_int_distribution<long long> d;
  return d(tw) % (y - x + 1) + x;
}
long long sqr(int a) { return (long long)a * a; }
template <class T>
T sqr(T const& a) {
  return a * a;
}
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
int const N = 333;
int n, m, t;
int tp, tu, td;
int a[N][N];
int rows[N][N], revrows[N][N];
int cols[N][N], revcols[N][N];
int calc_cost(int from, int to) {
  if (from < to) return tu;
  if (from > to) return td;
  return tp;
}
void solve() {
  scanf("%d%d%d%d%d%d", &n, &m, &t, &tp, &tu, &td);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", a[i] + j);
  for (int i = 0; i < n; ++i) {
    rows[i][0] = 0;
    for (int j = 0; j < m - 1; ++j)
      rows[i][j + 1] = rows[i][j] + calc_cost(a[i][j], a[i][j + 1]);
    revrows[i][m - 1] = 0;
    for (int j = m - 2; j >= 0; --j)
      revrows[i][j] = revrows[i][j + 1] + calc_cost(a[i][j + 1], a[i][j]);
  }
  for (int j = 0; j < m; ++j) {
    cols[0][j] = 0;
    for (int i = 0; i < n - 1; ++i)
      cols[i + 1][j] = cols[i][j] + calc_cost(a[i][j], a[i + 1][j]);
    revcols[n - 1][j] = 0;
    for (int i = n - 2; i >= 0; --i)
      revcols[i][j] = revcols[i + 1][j] + calc_cost(a[i + 1][j], a[i][j]);
  }
  int i1 = -1, j1 = -1, i2 = -1, j2 = -1, diff = INF;
  for (int x1 = 0; x1 < n; ++x1)
    for (int x2 = x1 + 2; x2 < n; ++x2)
      for (int y1 = 0; y1 < m; ++y1)
        for (int y2 = y1 + 2; y2 < m; ++y2) {
          int cur = rows[x1][y2] - rows[x1][y1] + cols[x2][y2] - cols[x1][y2] +
                    revrows[x2][y1] - revrows[x2][y2] + revcols[x1][y1] -
                    revcols[x2][y1] - t;
          cur = cur > 0 ? cur : -cur;
          if (cur < diff) {
            i1 = x1;
            j1 = y1;
            i2 = x2;
            j2 = y2;
            diff = cur;
          }
        }
  cout << i1 + 1 << ' ' << j1 + 1 << ' ' << i2 + 1 << ' ' << j2 + 1 << '\n';
}
int main() {
  cout << setprecision(15) << fixed;
  int tcnt = 1;
  for (int test = 1; test <= tcnt; ++test) solve();
}
