public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        n = Integer.parseInt(st.nextToken());
        m = Integer.parseInt(st.nextToken());
        t = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(br.readLine());
        tp = Integer.parseInt(st.nextToken());
        tu = Integer.parseInt(st.nextToken());
        td = Integer.parseInt(st.nextToken());
        a = new int[n][m];
        for(int i=0; i<n; i++){
            st = new StringTokenizer(br.readLine());
            for(int j=0; j<m; j++){
                a[i][j] = Integer.parseInt(st.nextToken());
            }
        }
        prep();
        int min = Integer.MAX_VALUE;
        int x=0,y=0,u=0,v=0;
        for(int i=0; i<n; i++){
            for(int j=i+2; j<n; j++){
                TreeSet<Data> set = new TreeSet<Data>();
                for(int e=2; e<m; e++){
                    set.add(new Data(e-2, colValueUp(e-2, j, i) - rowValueRight(i, 0, e-2) - rowValueLeft(j, e-2, 0)));
                    int ts = rowValueRight(i, 0, e) + colValueDown(e, i, j) + rowValueLeft(j, e, 0);
                    Data data = set.ceiling(new Data(0, t-ts));
                    if(data!=null){
                        if(Math.abs(ts+data.value-t)<min){
                            min = Math.abs(ts+data.value-t);
                            x=i; u=j; y=data.index; v=e;
                        }
                    }
                    data = set.floor(new Data(0, t-ts));
                    if(data!=null){
                        if(Math.abs(ts+data.value-t)<min){
                            min = Math.abs(ts+data.value-t);
                            x=i; u=j; y=data.index; v=e;
                        }
                    }
                }
            }
        }
        System.out.println((x+1)+" "+(y+1)+" "+(u+1)+" "+(v+1));
    }