A warehouse floor is an R by C grid of cells. Each cell is either open (.) or an obstacle (#). A bot begins on a given open cell and follows a command string of single-step moves:
U: row - 1,D: row + 1,L: column - 1,R: column + 1.
For each command the bot computes the target cell. If the target is inside the grid and open, the bot moves there; if the target is off the grid or an obstacle, the command is ignored and the bot stays put. Rows are numbered from 0 at the top; columns from 0 at the left.
Input format
Line 1: two integers R and C.
Next lines: each a string of characters, or .
Next line: two integers and , the starting cell (guaranteed open).
Next line: a non-empty command string over , , , .
Output format
A single line r c: the bot's final row and column.
Constraints
- 1 <= R, C <= 100
- 1 <= command string length <= 100000