Oxygen

You are given a four-dimensional cube (or, if you will, a hyperrectangle) with dimensions N × M × K × L, divided into four-dimensional unit cells.
The unit cell at coordinates (i, j, k, l) contains a[i][j][k][l] units of oxygen.
You must select a sub-cube with dimensions a × b × c × d that lies entirely in the given cube. The sub-cube cannot be rotated.
Consider the maximum quantity of oxygen of a unit cell in such a sub-cube. What is the smallest possible value of this quantity?

Input

The first line of input contains integers N, M, K, L.
The second line of input contains integers a, b, c, d.
The third line of input contains the oxygen quantities of the cube. You can use the following snippet of C++ code for reading this line:

    1 for(int i=1; i<=N; i++)
    2     for(int j=1; j<=M; j++)
    3         for(int k=1; k<=K; k++)
    4             for(int l=1; l<=L; l++)
    5                 scanf("%d", &v[i][j][k][l]);

Output

You should output a single integer.

Constraints

  • 1 ≤ N, M, K, L ≤ 35
  • 1 ≤ a ≤ N
  • 1 ≤ b ≤ M
  • 1 ≤ c ≤ K
  • 1 ≤ d ≤ L
  • -109 ≤ a[i][j][k][l] ≤ 109

Sample

InputOutputExplanation
3 3 3 1
2 2 2 1
2 4 1 2 4 1 2 4 4 2 4 1 2 1 1 2 2 1 2 4 2 2 2 2 3 2 1
2This testcase is a 3×3×3 three-dimensional cube:
  • First level:
    • 2 2 2
    • 2 2 2
    • 2 2 3
  • Second level:
    • 4 4 4
    • 4 1 2
    • 4 2 2
  • Third level:
    • 1 1 4
    • 1 1 1
    • 2 2 1
Questions?

Sponsors Gold