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
#include<bits/stdc++.h>
#define INF (1e9)
#define N 1005
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> P2;

int h, w, n, d[N][N][4];
string o, s[N];
int sy, sx;
int dy[4]={-1,0,1,0};
int dx[4]={0,1,0,-1};
int B[N], A[N][4];

priority_queue<P2,vector<P2>,greater<P2> > q;

bool dijkstra(){
  
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      for(int k=0;k<4;k++) d[i][j][k]=INF;
  
  q.push(P2(P(0,0),P(sy,sx)));
  
  d[sy][sx][0]=0;

  bool res=false;
  
  while(!q.empty()){

    P2 t=q.top(); q.pop();

    int cost=t.first.first;
    int dir=t.first.second;
    int y=t.second.first;
    int x=t.second.second;

    if(d[y][x][dir]<cost) continue;
    
    if(s[y][x]=='G') res=true;

    for(int i=0;i<4;i++){

      if(cost==o.size()||A[cost][i]==INF) continue;

      if(d[y][x][i]>A[cost][i]+1){
	
	d[y][x][i]=A[cost][i]+1;

	q.push(P2(P(A[cost][i]+1,i),P(y,x)));
      }
      
    }
    
    int ny=y+dy[dir], nx=x+dx[dir];
    
    if(ny<0||nx<0||h<=ny||w<=nx) continue;
    if(s[ny][nx]=='#') continue;

    if(d[ny][nx][dir]>cost){

      d[ny][nx][dir]=cost;
      
      q.push(P2(P(cost,dir),P(ny,nx)));
    }
    
  }
  
  return res;
}

int main(){
  
  while(1) {
    
    cin>>h>>w>>n;
    if(!h&&!w&&!n) break;
  
    cin>>o;

    for(int i=0;i<h;i++){
    
      cin>>s[i];

      for(int j=0;j<w;j++)
	if(s[i][j]=='S') sy=i, sx=j;
    
    }

    int dir=0;
    
    for(int i=0;i<n;i++){
      
      if(o[i]=='L') dir=(dir+3)%4;
      else dir=(dir+1)%4;
      
      B[i]=dir;
     
    }
    
    int dir2[4];
    
    for(int i=0;i<4;i++) dir2[i]=INF;
    
    for(int i=n-1;i>=0;i--){
      
      dir2[B[i]] = min(dir2[B[i]],i);

      for(int j=0;j<4;j++) A[i][j] = dir2[j];
      
    }
    
    if(dijkstra()) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

  }
  
  return 0;
}