#include <bits/stdc++.h>
int up[310][310];
int down[310][310];
int left[310][310];
int right[310][310];
int t[3];
int o[310][310];
int abso(int x) {
  if (x < 0) return -x;
  return x;
}
int main() {
  int n, m;
  int clos;
  scanf("%d %d %d", &n, &m, &clos);
  scanf("%d %d %d", &t[0], &t[1], &t[2]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &o[i][j]);
      if (i - 1 > 0) {
        if (o[i][j] == o[i - 1][j]) {
          up[i][j] += t[0];
          down[i][j] += t[0];
        } else if (o[i][j] > o[i - 1][j]) {
          up[i][j] += t[2];
          down[i][j] += t[1];
        } else {
          up[i][j] += t[1];
          down[i][j] += t[2];
        }
      }
      if (j - 1 > 0) {
        if (o[i][j] == o[i][j - 1]) {
          right[i][j] += t[0];
          left[i][j] += t[0];
        } else if (o[i][j] > o[i][j - 1]) {
          right[i][j] += t[1];
          left[i][j] += t[2];
        } else {
          right[i][j] += t[2];
          left[i][j] += t[1];
        }
      }
      left[i][j] += left[i][j - 1];
      right[i][j] += right[i][j - 1];
      up[i][j] += up[i - 1][j];
      down[i][j] += down[i - 1][j];
    }
  }
  int ans = 1 << 30;
  int ansx = 0, ansy = 0, ansa = 0, ansb = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int k = i + 2; k <= n; k++) {
        for (int l = j + 2; l <= m; l++) {
          int sum = 0;
          sum += right[i][l] - right[i][j];
          sum += down[k][l] - down[i][l];
          sum += left[k][l] - left[k][j];
          sum += up[k][j] - up[i][j];
          int tmp = abso(sum - clos);
          if (tmp < ans) {
            ans = tmp;
            ansx = i;
            ansy = j;
            ansa = k;
            ansb = l;
          }
        }
      }
    }
  }
  printf("%d %d %d %d\n", ansx, ansy, ansa, ansb);
  return 0;
}
