The Light King and the Mirror Maze 1

No attempts yetTime limit2sMemory limit256 MB

Problem

The young light king likes toys. His favourite toy right now is an N×MN \times M rectangular board where a diagonal mirror can be pushed into any cell and pulled back out. He arranges the mirrors as he likes, then aims a laser at the centre of one border cell, perpendicular to that cell's outer side, and the laser comes back out of a different cell. He finds that fascinating.

He gave every border cell a positive integer number in the following way.

  • the MM cells along the top: 11 to MM, from left to right
  • the NN cells along the left: M+1M+1 to M+NM+N, from top to bottom
  • the NN cells along the right: M+N+1M+N+1 to M+N+NM+N+N, from top to bottom
  • the MM cells along the bottom: M+N+N+1M+N+N+1 to M+N+N+MM+N+N+M, from left to right

A corner cell touches the outside on two of its sides, so it receives two numbers. On a board with N=2N=2 and M=3M=3, for example, the three cells of the first row are 11, 22, 33 from the left, the two cells of the left column are 44, 55 from the top, the two cells of the right column are 66, 77 from the top, and the three cells of the last row are 88, 99, 1010 from the left. The top left cell is both 11 and 44. A number also names the side the laser passes through. A laser fired at 11 enters the top left cell downward through its top side, and a laser fired at 44 enters the same cell rightward through its left side. Leaving at yy means the laser crosses the side named by yy and goes outside the board.

The king is interested in toys where a laser fired at xx leaves at yy. The mirror layout he wants is given as NN strings of length MM, and the characters mean the following.

  • / : a mirror that reflects a laser arriving from the left to the top, one arriving from the top to the left, one arriving from the right to the bottom, and one arriving from the bottom to the right.
  • \ : a mirror that reflects a laser arriving from the left to the bottom, one arriving from the top to the right, one arriving from the right to the top, and one arriving from the bottom to the left.
  • . : a cell with no mirror, where the laser passes through undisturbed.
  • ? : a cell where any one of the three above is acceptable.

The more ? cells there are, the more layouts can be built. Count how many of those layouts send a laser fired at xx out at yy.

Input

The first line contains two integers NN, MM (1N,M81 \le N, M \le 8) giving the size of the board, then xx, yy (1x,y2(N+M)1 \le x, y \le 2(N+M)), separated by spaces.

Each of the next NN lines contains a string of length MM. Each string consists only of /, \, ., and ?.

The whole board contains at most 1212 ? characters.

Output

Print the number of layouts in which a laser fired at xx leaves at yy, modulo 1000710007.