Problem E - Robot Navigation

Mobile Manufacturing has designed a section of its factory floor to utilize a robot to deliver parts from one location to another. The robot runs on a track; the factory floor is set up in a grid of tracks running north/south and east/west. The square area in between tracks is called a "grid square." The robot must move along its tracks, but may change its direction of movement at each track crossing point. From a crossing point, it may move in any of the four directions: north, south, east, or west. The robot is shaped like a cylinder whose center is on the track. When centered on a track crossing, the robot's body takes up most of the four surrounding grid squares.

The robot has a map of the factory floor, including the location of obstacles. Obstacles are considered to be complete grid squares which the robot may not enter with any part of its body. The map is specified in terms of the grid squares: the robot may go around the outside of the grid.

A sample picture of the robot's situation is given below.

The movement of the robot is controlled by four commands: NORTH, SOUTH, EAST, and WEST. Each command moves the robot in the specified direction from one track crossing to the next. Each movement command takes one second to execute.

Mobile Manufacturing needs its delivery robot to move from place to place as quickly as possible. Write a program which will determine the minimal time/number of steps with which the robot can move from a given starting location to a given destination.

Input

The input file consists of a series of problem statements given as blocks of lines. The first line of each block contains two integers M <= 20 and N <= 20 separated by one space. The factory grid has M rows of grid squares (not tracks!) and N columns of grid squares. The next M lines of the input file contain N numbers each, either one or zero, separated by one space. One represents obstacles and zero represents empty squares. The tracks are between the squares.

After the M rows desribing the grid map, there is one line containing SR and SC, the row and column track numbers where the robot starts, and GR and GC, the row and column track numbers where the robot should end. Tracks on the grid are numbered from the upper left edge starting with zero (the northernmost row track is zero, as it the westernmost column track) and going through M or N (the southernmost track is M, and the easternmost track is N). Grid squares are numbered similarly.

The end of input is indicated by grid dimensions of 0 and 0.

Output

The output should contain one line for each navigation problem in the input. The line should contain the minimal number of seconds in which the robot can reach the destination point from the starting point. If there does not exist any path from the starting point to the destination point the line should contain -1.

Example


An illustration for the second navigation problem below.


Sample Input

4 4
0 0 0 0
0 0 0 0
0 0 1 1
0 0 1 1
3 1 1 3
9 10
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1 0
7 2 2 7
0 0


Sample Output

4
10