Олимпиадный тренинг

Задача 38360. Beam of light in the dark realm


The Dark Kingdom is an NxM labyrinth, some cells of which are surrounded by mirror walls, and the rest — empty. The entire labyrinth is also surrounded by a wall of mirrors. In one of the empty cells of the labyrinth, a traffic light was placed that emits rays in 4 directions: at 45 degrees relative to the walls of the labyrinth. It is required to depict the trajectory of these rays.

When the beam comes to the corner through which the mirror walls pass, it goes further as shown in the pictures (the cells that are surrounded by mirror walls are shown in gray). The ray behaves in a similar way when it comes to the border of the maze.


Input
The first line of the input file contains two natural numbers N and M — the number of rows and columns in the maze (each of the numbers is not less than 1 and not more than 100). The next N lines contain exactly M characters in each — labyrinth map. The symbol * (asterisk) denotes a cell surrounded by mirrored walls, . (dot) — empty cell, symbol X (capital Latin letter X) — the cell in which the traffic light is located (there is exactly one such cell).

Imprint
In the output file print N lines with M characters in each — image of a labyrinth with trajectories of rays. Here, as before, * (asterisk) should denote cells surrounded by mirrored walls, . (dot) — empty cells through which light rays do not pass, / (slash) — cells through which the beam of light passes from the lower left corner to the upper right (or back — from the upper right to the lower left), \ (backslash) — the cells through which the ray passes from the upper left corner to the lower right (or vice versa), and the symbol X (capital Latin letter X) — cells through which rays pass along both diagonals.
Examples
# Input Output
1
3 5
X....
.....
.....
XXXXX
XXXXX
XXXXX
2
3 3
...
..X
...
/X\
X.X
\X/