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<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<stack>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define stop char nyaa;cin>>nyaa;
const ll mod = 1000000007;
typedef pair<int, int> P;

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

typedef pair<int, P> speP;

int h, w, n;
bool valid(int x, int y) {
	if (x < 0 || y < 0 || x >= h || y >= w)return false;
	return true;
}

void solve() {
	string s;
	cin >> s;
	vector<int> ra(n + 1,0);
	rep(i, n) {
		int nex = 0;
		if (s[i] == 'L') {
			nex = ra[i] - 1;
		}
		else {
			nex = ra[i] + 1;
		}
		if (nex == 4)nex = 0;
		else if (nex < 0)nex = 3;
		ra[i + 1] = nex;
	}
	vector<int> loc[4];
	rep(i, n+1) {
		loc[ra[i]].push_back(i);
	}
	rep(i, 4)loc[i].push_back(mod);
	vector<vector<int>> v(n+1);
	rep(i, n+1) {
		v[i].resize(4);
		rep(j, 4) {
			int id = lower_bound(loc[j].begin(), loc[j].end(), i) - loc[j].begin();
			v[i][j] = loc[j][id];
		}
	}
	vector<vector<char>> mp(h);
	int sx, sy, gx, gy;
	rep(i, h) {
		mp[i].resize(w);
		rep(j, w) {
			cin >> mp[i][j];
			if (mp[i][j] == 'S') {
				sx = i, sy = j;
			}
			else if(mp[i][j]=='G'){
				gx = i, gy = j;
			}
		}
	}
	vector<vector<int>> dist(h);
	rep(i, h) {
		dist[i].resize(w, mod);
	}
	dist[sx][sy] = 0;
	priority_queue<speP, vector<speP>, greater<speP>> q;
	q.push({ 0,{sx,sy} });
	while (!q.empty()) {
		speP p = q.top(); q.pop();
		int x = p.second.first, y = p.second.second;
		int t = p.first;
		if (dist[x][y] < t)continue;
		rep(j, 4) {
			int nd = v[t][j];
			int cx = x, cy = y;
			while (true) {
				cx += dx[j], cy += dy[j];
				if (!valid(cx, cy))break;
				if (mp[cx][cy] == '#')break;
				if (nd < dist[cx][cy]) {
					dist[cx][cy] = nd;
					q.push({ nd,{cx,cy} });
				}
				else break;
			}
		}
	}
	if (dist[gx][gy] == mod) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (cin >> h >> w >> n, h | w | n) {
		solve();
	}
	//stop
	return 0;
}