#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int M = 305;
int mp[M][M], row[M][M], col[M][M], row2[M][M], col2[M][M];
int abs(int a) {
  if (a < 0) return -a;
  return a;
}
int main() {
  int n, m, t, a, b, c;
  int i, j, k;
  while (~scanf("%d%d%d", &n, &m, &t)) {
    scanf("%d%d%d", &a, &b, &c);
    memset(row, 0, sizeof(row));
    memset(col, 0, sizeof(col));
    memset(row2, 0, sizeof(row2));
    memset(col2, 0, sizeof(col2));
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        scanf("%d", &mp[i][j]);
        if (j > 1) {
          if (mp[i][j] > mp[i][j - 1])
            row[i][j] = row[i][j - 1] + b;
          else if (mp[i][j] < mp[i][j - 1])
            row[i][j] = row[i][j - 1] + c;
          else if (mp[i][j] == mp[i][j - 1])
            row[i][j] = row[i][j - 1] + a;
        }
        if (i > 1) {
          if (mp[i][j] > mp[i - 1][j])
            col[i][j] = col[i - 1][j] + b;
          else if (mp[i][j] < mp[i - 1][j])
            col[i][j] = col[i - 1][j] + c;
          else if (mp[i][j] == mp[i - 1][j])
            col[i][j] = col[i - 1][j] + a;
        }
      }
    }
    for (i = n; i >= 1; i--) {
      for (j = m; j >= 1; j--) {
        if (j < m) {
          if (mp[i][j] > mp[i][j + 1])
            row2[i][j] = row2[i][j + 1] + b;
          else if (mp[i][j] < mp[i][j + 1])
            row2[i][j] = row2[i][j + 1] + c;
          else if (mp[i][j] == mp[i][j + 1])
            row2[i][j] = row2[i][j + 1] + a;
        }
        if (i < n) {
          if (mp[i][j] > mp[i + 1][j])
            col2[i][j] = col2[i + 1][j] + b;
          else if (mp[i][j] < mp[i + 1][j])
            col2[i][j] = col2[i + 1][j] + c;
          else if (mp[i][j] == mp[i + 1][j])
            col2[i][j] = col2[i + 1][j] + a;
        }
      }
    }
    int ii, jj, len = 0;
    int mx = inf;
    int st = 0, ed = 0, st1 = 0, ed1 = 0;
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        for (ii = i + 2; ii <= n; ii++) {
          for (jj = j + 2; jj <= m; jj++) {
            len = abs((row[i][jj] - row[i][j]) + (col[ii][jj] - col[i][jj]) +
                      (row2[ii][j] - row2[ii][jj]) +
                      (col2[i][j] - col2[ii][j]) - t);
            if (len < mx) {
              mx = len;
              st = i, ed = j, st1 = ii, ed1 = jj;
            }
          }
        }
      }
    }
    printf("%d %d %d %d\n", st, ed, st1, ed1);
  }
  return 0;
}
