#include <bits/stdc++.h>
using namespace std;
const int millon = 1000000;
int n, m, t;
int tp, tu, td;
inline int appr(int k) { return abs(k - t); }
int main() {
  cin >> n >> m >> t;
  cin >> tp >> tu >> td;
  vector<vector<int> > hleft(n, vector<int>(m, 0));
  vector<vector<int> > hright(n, vector<int>(m, 0));
  vector<vector<int> > vup(n, vector<int>(m, 0));
  vector<vector<int> > vdown(n, vector<int>(m, 0));
  vector<vector<int> > grid(n, vector<int>(m, 0));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cin >> grid[i][j];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (j > 0) hright[i][j] += hright[i][j - 1];
      if (i > 0) vdown[i][j] += vdown[i - 1][j];
      if (j > 0 and grid[i][j - 1] > grid[i][j]) hright[i][j] += td;
      if (j > 0 and grid[i][j - 1] < grid[i][j]) hright[i][j] += tu;
      if (j > 0 and grid[i][j - 1] == grid[i][j]) hright[i][j] += tp;
      if (i > 0 and grid[i - 1][j] > grid[i][j]) vdown[i][j] += td;
      if (i > 0 and grid[i - 1][j] < grid[i][j]) vdown[i][j] += tu;
      if (i > 0 and grid[i - 1][j] == grid[i][j]) vdown[i][j] += tp;
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    for (int j = m - 1; j >= 0; --j) {
      if (j < m - 1) hleft[i][j] += hleft[i][j + 1];
      if (i < n - 1) vup[i][j] += vup[i + 1][j];
      if (j < m - 1 and grid[i][j + 1] > grid[i][j]) hleft[i][j] += td;
      if (j < m - 1 and grid[i][j + 1] < grid[i][j]) hleft[i][j] += tu;
      if (j < m - 1 and grid[i][j + 1] == grid[i][j]) hleft[i][j] += tp;
      if (i < n - 1 and grid[i + 1][j] > grid[i][j]) vup[i][j] += td;
      if (i < n - 1 and grid[i + 1][j] < grid[i][j]) vup[i][j] += tu;
      if (i < n - 1 and grid[i + 1][j] == grid[i][j]) vup[i][j] += tp;
    }
  }
  int mini, minj, maxi, maxjj;
  int subnormal = 1000000009;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int k = i + 2; k < n; ++k) {
        for (int l = j + 2; l < m; ++l) {
          int cuadrao = (hright[i][l] - hright[i][j]) +
                        (vdown[k][l] - vdown[i][l]) +
                        (hleft[k][j] - hleft[k][l]) + (vup[i][j] - vup[k][j]);
          if (appr(cuadrao) < subnormal) {
            subnormal = appr(cuadrao);
            mini = i, minj = j, maxi = k, maxjj = l;
          }
        }
      }
    }
  }
  cout << mini + 1 << ' ' << minj + 1 << ' ' << maxi + 1 << ' ' << maxjj + 1
       << endl;
}
