In a rectangular matrix of size N \times M, the layout of an ancient castle is encoded. Each cell of the plan is represented by an integer (0 \leq A \leq 31), which is formed by the sum of numbers according to the following rules:
if there is a wall to the west;
if there is a wall to the north;
if there is a wall to the east;
if there is a wall to the south;
if there is a bag of gold in the cell.
An internal wall is shared by two cells. For example, the southern wall of cell is also the northern wall of cell (see the illustration and the sample input file).
A cell on the boundary without the corresponding outer wall is called an exit cell. The illustration shows two such cells: and . There are at most exit cells in total.
The gnome is located at the cell with the given coordinates . He can move to a neighboring cell by crossing a shared side, provided castle walls do not block the way. The gnome can carry exactly one bag of gold (he cannot carry more). What is the minimum number of steps for the gnome to reach any exit cell while collecting exactly one bag of gold?

The first line contains four integers: – the dimensions of the matrix (1 \leq N, M \leq 50) and – the coordinates of the gnome (1 \leq i \leq N, 1 \leq j \leq M). The next lines each contain integers, describing the castle plan as explained above.
Output a single number – the minimum number of steps to reach any exit, or if the gnome cannot complete the task.
Example 1