#include <bits/stdc++.h>
using namespace std;
int n, m, t, tp, tu, td;
int a[310][310], l[310][310], r[310][310];
int u[310][310], d[310][310];
inline int g(int x, int y) {
  if (x == y) return tp;
  return (x < y) * tu + (x > y) * td;
}
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &t, &tp, &tu, &td);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (i != 1) u[i][j] = u[i - 1][j] + g(a[i - 1][j], a[i][j]);
      if (i != 1) d[i][j] = d[i - 1][j] + g(a[i][j], a[i - 1][j]);
      if (j != 1) l[i][j] = l[i][j - 1] + g(a[i][j - 1], a[i][j]);
      if (j != 1) r[i][j] = r[i][j - 1] + g(a[i][j], a[i][j - 1]);
    }
  int ans = INT_MAX, x1, y1, x2, y2;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int k = i + 2; k <= n; k++)
        for (int p = j + 2; p <= m; p++) {
          int tmp = l[i][p] - l[i][j] + r[k][p] - r[k][j] + d[k][j] - d[i][j] +
                    u[k][p] - u[i][p];
          if (ans > abs(tmp - t)) {
            ans = abs(tmp - t);
            x1 = i, x2 = k, y1 = j, y2 = p;
          }
        }
  printf("%d %d %d %d\n", x1, y1, x2, y2);
}
