#include <bits/stdc++.h>
using namespace std;
int n, m, t, tp, tu, td;
int a[305][305], f[305][305][4];
int dis(int x, int y) {
  if (x == y) return tp;
  if (x < y) return tu;
  return td;
}
int main() {
  cin >> n >> m >> t >> tp >> tu >> td;
  ;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> a[i][j];
  for (int i = 1; i <= n; ++i)
    for (int j = 2; j <= m; ++j)
      f[i][j][0] = f[i][j - 1][0] + dis(a[i][j - 1], a[i][j]);
  for (int i = 1; i <= n; ++i)
    for (int j = m - 1; j > 0; --j)
      f[i][j][2] = f[i][j + 1][2] + dis(a[i][j + 1], a[i][j]);
  for (int j = 1; j <= m; ++j)
    for (int i = 2; i <= n; ++i)
      f[i][j][1] = f[i - 1][j][1] + dis(a[i - 1][j], a[i][j]);
  for (int j = 1; j <= m; ++j)
    for (int i = n - 1; i > 0; --i)
      f[i][j][3] = f[i + 1][j][3] + dis(a[i + 1][j], a[i][j]);
  int x1, x2, y1, y2, ans = (int)1e9;
  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 p = f[i][l][0] - f[i][j][0] + f[k][l][1] - f[i][l][1] +
                  f[k][j][2] - f[k][l][2] + f[i][j][3] - f[k][j][3];
          p = abs(p - t);
          if (p < ans) ans = p, x1 = i, x2 = k, y1 = j, y2 = l;
        }
  cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
  return 0;
}
