#include <bits/stdc++.h>
using namespace std;
int n, m, t, tp, tu, td;
int v[305][305], s[305][305][4];
inline int add(int x, int y) {
  if (x == y) return tp;
  if (x < y) return td;
  return tu;
}
int main() {
  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", &v[i][j]);
    }
  }
  for (int j = 1; j < m; ++j) {
    for (int i = 0; i < n; ++i) {
      s[i][j][0] = s[i][j - 1][0] + add(v[i][j], v[i][j - 1]);
      s[i][j][1] = s[i][j - 1][1] + add(v[i][j - 1], v[i][j]);
    }
  }
  for (int j = 0; j < m; ++j) {
    for (int i = 1; i < n; ++i) {
      s[i][j][2] = s[i - 1][j][2] + add(v[i][j], v[i - 1][j]);
      s[i][j][3] = s[i - 1][j][3] + add(v[i - 1][j], v[i][j]);
    }
  }
  int anst = INT_MAX, sum;
  int a0, a1, a2, a3;
  for (int x1 = 0; x1 < n - 2; ++x1) {
    for (int y1 = 0; y1 < m - 2; ++y1) {
      for (int x2 = x1 + 2; x2 < n; ++x2) {
        for (int y2 = y1 + 2; y2 < m; ++y2) {
          sum = s[x1][y2][0] - s[x1][y1][0] + s[x2][y2][1] - s[x2][y1][1] +
                s[x2][y2][2] - s[x1][y2][2] + s[x2][y1][3] - s[x1][y1][3];
          if (sum == t) {
            printf("%d %d %d %d", x1 + 1, y1 + 1, x2 + 1, y2 + 1);
            return 0;
          }
          int temp = abs(sum - t);
          if (temp < anst)
            anst = temp, a0 = x1 + 1, a1 = y1 + 1, a2 = x2 + 1, a3 = y2 + 1;
        }
      }
    }
  }
  printf("%d %d %d %d", a0, a1, a2, a3);
  return 0;
}
