#include <bits/stdc++.h>
using namespace std;
const int MAX = 300 + 2;
int h[MAX][MAX];
int up[MAX][MAX];
int down[MAX][MAX];
int lft[MAX][MAX];
int rht[MAX][MAX];
int tp, tu, td;
int n, m;
void cal_up() {
  for (int j = 1; j <= m; j++) {
    for (int i = n - 1; i >= 1; i--) {
      up[i][j] =
          up[i + 1][j] +
          (h[i][j] == h[i + 1][j] ? tp : (h[i][j] > h[i + 1][j] ? tu : td));
    }
  }
}
void cal_down() {
  for (int j = 1; j <= m; j++) {
    for (int i = 2; i <= n; i++) {
      down[i][j] =
          down[i - 1][j] +
          (h[i][j] == h[i - 1][j] ? tp : (h[i][j] > h[i - 1][j] ? tu : td));
    }
  }
}
void cal_lft() {
  for (int i = 1; i <= n; i++) {
    for (int j = m - 1; j >= 1; j--) {
      lft[i][j] =
          lft[i][j + 1] +
          (h[i][j] == h[i][j + 1] ? tp : (h[i][j] > h[i][j + 1] ? tu : td));
    }
  }
}
void cal_rht() {
  for (int i = 1; i <= n; i++) {
    for (int j = 2; j <= m; j++) {
      rht[i][j] =
          rht[i][j - 1] +
          (h[i][j] == h[i][j - 1] ? tp : (h[i][j] > h[i][j - 1] ? tu : td));
    }
  }
}
pair<pair<int, int>, pair<int, int> > solve(int t) {
  int ret = -1;
  pair<pair<int, int>, pair<int, int> > ans;
  for (int x1 = 1; x1 <= n; x1++) {
    for (int y1 = 1; y1 <= m; y1++) {
      for (int x2 = x1 + 2; x2 <= n; x2++) {
        for (int y2 = y1 + 2; y2 <= m; y2++) {
          int tmp = 0;
          tmp += rht[x1][y2] - rht[x1][y1];
          tmp += down[x2][y2] - down[x1][y2];
          tmp += lft[x2][y1] - lft[x2][y2];
          tmp += up[x1][y1] - up[x2][y1];
          tmp -= t;
          if (tmp < 0) {
            tmp = -tmp;
          }
          if (tmp == 0) {
            return make_pair(make_pair(x1, y1), make_pair(x2, y2));
          }
          if (tmp < ret || ret == -1) {
            ret = tmp;
            ans = make_pair(make_pair(x1, y1), make_pair(x2, y2));
          }
        }
      }
    }
  }
  return ans;
}
int main(int argc, char *argv[]) {
  int t;
  cin >> n >> m >> t;
  cin >> tp >> tu >> td;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &h[i][j]);
    }
  }
  cal_rht();
  cal_lft();
  cal_down();
  cal_up();
  pair<pair<int, int>, pair<int, int> > ans = solve(t);
  printf("%d %d %d %d\n", ans.first.first, ans.first.second, ans.second.first,
         ans.second.second);
  return 0;
}
