Problem: A robot in a two-dimensional maze again. The maze has an entrance and an exit this time, though.

Just as in the previous problem, the maze is made up of H × W grid cells, its upper side faces north, and each cell is either empty or wall. Unlike the previous, on the other hand, one of the empty cells is connected to the entrance and another to the exit.

The robot is rather complex - there is some control, but not full. It is associated with a controller that has two buttons, namely forward and turn. The forward button moves the robot forward to the next cell, if possible. The robot can not move into a wall nor outside the maze. The turn button turns the robot as programmed. Here the program is a finite sequence of N commands, each of which is either 'L' (indicating a left turn) or 'R' (a right turn). The first turn follows the first command; the second turn follows the second command; similar for the following turns. The turn button stops working once the commands are exhausted; the forward button still works in such a case though. The robot always turns by 90 degrees at once.

The robot is initially put on the entrance cell, directed to the north. Your mission is to determine whether it can reach the exit cell if controlled properly.



Input

The input is a sequence of datasets. Each dataset is formatted as follows.

H W N
s1 ... sN
c1,1c1,2...c1,W
...
cH,1cH,2...cH,W


The first line of a dataset contains three integers H, W and N (1 ≤ H, W ≤ 1,000, 1 ≤ N ≤ 1,000,000).

The second line contains a program of N commands.

Each of the following H lines contains exactly W characters. Each of these characters represents a cell of the maze. "." indicates empty, "#" indicates a wall, "S" indicates an entrance, and "G" indicates an exit. There is exactly one entrance cell and one exit cell.

The end of input is indicated by a line with three zeros.

Output

For each dataset, output whether the robot can reach the exit in a line: "Yes" if it can or "No" otherwise (without quotes).

Examples

Input

2 2 1
L
G.
#S
2 2 2
RR
G.
.S
3 3 6
LLLLLL
G#.
...
.#S
0 0 0


Output

Yes
No
Yes


Input

2 2 1
L
G.
S
2 2 2
RR
G.
.S
3 3 6
LLLLLL
G#.
...
.#S
0 0 0


Output

Yes
No
Yes

Solution (in CPP):

Solution:
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
using namespace std;

typedef long long ll;

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

class State{
public:
  int x,y,d,idx;
  State(){}
  State(int _x,int _y,int _d,int _idx){
    x = _x;
    y = _y;
    d = _d;
    idx = _idx;
  }
};

int sx,sy;
int gx,gy;

int h,w,n;
int next_dir[1000002][4];
bool closed[1002][1002][4];
char t[1002][1002];
string s;

int dir[1000002];

int dx[] = {0,1,0,-1};
int dy[] = {-1,0,1,0};

bool solve(){
  queue<State> open;
  memset(closed,0,sizeof(closed));

  open.push(State(sx,sy,0,0));

  while(!open.empty()){
    State st = open.front();
    open.pop();

    if(closed[st.x][st.y][st.d]){
      continue;
    }
    closed[st.x][st.y][st.d] = true;

    if(st.x == gx && st.y == gy){
      return true;
    }

    rep(i,4){
      if(next_dir[st.idx][i] != -1){
        int nx = st.x + dx[i];
        int ny = st.y + dy[i];

        if(nx < 0 || w <= nx || ny < 0 || h <= ny || t[ny][nx] == '#'){
          nx -= dx[i];
          ny -= dy[i];
        }

        open.push(State(nx,ny,i,next_dir[st.idx][i]));
      }
    }
  }

  return false;
}

int main(){
  while(cin>>h>>w>>n,h||w||n){
    cin>>s;

    rep(i,h){
      cin>>t[i];
      rep(j,w){
        if(t[i][j] == 'S'){
          sx = j;
          sy = i;
        }
        else if(t[i][j] == 'G'){
          gx = j;
          gy = i;
        }
      }
    }

    memset(next_dir,-1,sizeof(next_dir));

    int d = 0;

    rep(i,n+1){
      dir[i] = d;
      if(s[i] == 'L'){
        d = (d + 3) % 4;
      }
      else{
        d = (d + 1) % 4;
      }
    }

    int table[4];
    memset(table,-1,sizeof(table));

    for(int i=n;i>=0;i--){
      table[dir[i]] = i;
      rep(j,4){
        next_dir[i][j] = table[j];
      }
    }

    bool flg = solve();
    cout<<(flg ? "Yes" : "No")<<endl;
  }
}