All the action takes place in a rectangular area which, for the sake of
simplicity, is divided into unit squares numbered from  to
 to  .
Starting at
.
Starting at  , the knights move from one square to one of the at most four adjacent squares, and
finish as soon as they reach
, the knights move from one square to one of the at most four adjacent squares, and
finish as soon as they reach  where the tavern is located.
At each square, it is largely a matter of chance where the fight will continue,
but it also depends on the environment (for example, if a certain direction is
uphill).
Our model uses probabilities to decide into which adjacent square the fight will move
next. (For example, an uphill direction has a lower probability.)
It is your job to calculate the expected number of moves that are needed before
the tavern is reached. You can assume that every move is independent of the
directions chosen in the previous moves.
 where the tavern is located.
At each square, it is largely a matter of chance where the fight will continue,
but it also depends on the environment (for example, if a certain direction is
uphill).
Our model uses probabilities to decide into which adjacent square the fight will move
next. (For example, an uphill direction has a lower probability.)
It is your job to calculate the expected number of moves that are needed before
the tavern is reached. You can assume that every move is independent of the
directions chosen in the previous moves.
	
	Input 
The input consists of a sequence of rectangular areas.
Each area starts with a line containing the dimensions of the rectangle  and
 and  , where
, where 
 .
Four blocks follow that state the probability of a move in each direction.
Every block contains
.
Four blocks follow that state the probability of a move in each direction.
Every block contains  lines, and each line contains
 lines, and each line contains  numbers
 numbers 
 , where
, where 
 for all
 for all 
 and
 and 
 and
 and 
 .
The probabilities in block
.
The probabilities in block  are arranged as follows:
 are arranged as follows:
 
The number
 gives the probability of a move from square
 gives the probability of a move from square  to the next square:
In block
 to the next square:
In block  this is
 this is  , in block
, in block  it is
 it is  , in block
, in block  it is
 it is  and in block
 and in block  it is
 it is  .
For each square
.
For each square  except the tavern
 except the tavern  , the probabilities
, the probabilities 
 add up to
 add up to  and at least one of
 and at least one of 
 or
 or 
 is not 0
. (This ensures that the tavern will finally be reached with probability
 is not 0
. (This ensures that the tavern will finally be reached with probability  .)
You may assume that the probability of moving outside the rectangle is 0
, as are
.)
You may assume that the probability of moving outside the rectangle is 0
, as are 
 for all
 for all  .
The sequence of areas is followed by a line containing two zeros.
.
The sequence of areas is followed by a line containing two zeros.
	Output 
For each area, output a line containing the expected number of moves from
 to
 to  .  This number must have an absolute error less than
.  This number must have an absolute error less than  compared to
the exact answer that is always less than
 compared to
the exact answer that is always less than  .
.
Sample Input
Sample Output