F. Pacman or Shot
time limit per test
2 s
memory limit per test
256 megabytes
input
standard input
output
standard output

New generations of competitive programers always hear about the lengendaries Shot Contests, a programming contest mixed with drinking games that left behind a lot stories to tell. During the contest every wrong submission comes with a shot of your favourite booze, every first sumbission allows you to delivery a shot to any team of your choice and every half hour a random team must drink.

Sadly during the last Shot Contest held, the problems were really easy and the drinks so soft. After all the teams solved the problems they wanted to drink more. Jhonny had a brilliant idea, he saw a weird Pacman machine at the corner of the house and told everybody "Whoever that cannot make Pacman escape from the ghost must have to drink".

The machine contains a modified version of the classic Pacman game, where the objective is to escape from the ghost. There is going to be just one ghost in the game that will be always following pacman through the shortest route, he also knows Pacman's route since the beggining. It is important to note that every time Pacman goes trough the border of the maze he is going to jump to the opposite side of the map if that is not a wall. But the Ghost cannot teleport through the borders. If Pacman or the Ghost try to move to a position that contains a wall, they will stay in the current position.

Jhonny wanted to give it a try, given the configuration of the maze and the route followed by Pacman, tell Jhonny if he has to drink or not.

Input

The first line of the input contains elements $$$1 \leq R, C \leq 5*10^3$$$ number of rows and columns of the maze.

Following R lines with C characters, representing the maze, '.' is an empty space , '#' a wall , 'P' pacman position and 'G' ghost position

Finally a string S containing Pacman's path, it can contain only the following characters according the direction 'L' left, 'R', right, 'D' down and 'U', up. $$$|S| \leq 3 * (R+C)$$$

Output

Print 'Yes' or 'No' if the ghost can reach Pacman on time.

Examples
Input
7 7
....P..
..#..#.
..#..#.
..####.
.G.....
.......
.......
RRRRRRDD
Output
Yes
Input
7 7
....P..
..#..#.
..#..#.
..####.
.......
.......
.G.....
RRRRRRDD
Output
No