The young light king likes toys. His current favorite is an N×M rectangular board where a diagonal mirror can be pushed into or pulled out of every cell. Once the mirrors are in place he aims a laser at the center of a border cell, perpendicular to that cell's outer edge, and the beam leaves the board through another cell. He never tires of watching it.
Every border cell carries one natural number, assigned this way.
Each of the four corner cells gets two numbers. A beam entering through the top edge and a beam entering through the left edge use different numbers. For N=2 and M=3 the border is numbered like this.
1 2 3
4 . . . 6
5 . . . 7
8 9 10
The king cares about toys where a laser fired into x comes out at y. He also wants a particular arrangement, so the mirror layout he asks for is given as N strings of length M. The characters mean this.
/: a mirror that sends a beam arriving from the left upward, a beam from above to the left, a beam from the right downward, and a beam from below to the right.\: a mirror that sends a beam arriving from the left downward, a beam from above to the right, a beam from the right upward, and a beam from below to the left..: an empty cell, where the beam passes straight through.?: a cell that may hold any one of the three above.The more ? characters there are, the more layouts the board admits. Count the layouts in which a laser fired into x leaves at y.
The first line has two integers N and M (1≤N,M≤8), the size of the board, and two integers x and y (1≤x,y≤2(N+M)), separated by spaces.
Each of the next N lines has a string of length M. The string consists only of /, \, . and ?.
Print the number of layouts in which a laser fired into x leaves at y, taken modulo 10007.
One cell with a mirror in it pairs up its four edges. . pairs top with bottom and left with right, / pairs top with left and bottom with right, and \ pairs top with right and bottom with left. Across the whole board the edges join into paths that always match border numbers in twos, so the answer is 0 when x equals y.