#include<bits/stdc++.h>
#define ll long long
using namespace std;
char yx[505][505];
int f1[505];
int f2[505];
int main(){
int n,m,k,l=1,o=0;
cin>>n>>m>>k;
string s;
cin>>s;
for(int i=0;i<s.size();i++){
if(s[i]=='L'){
f2[i+1]=-1;
f1[i+1]=0;
}
if(s[i]=='R'){
f2[i+1]=1;
f1[i+1]=0;
}
if(s[i]=='U'){
f2[i+1]=0;
f1[i+1]=-1;
}
if(s[i]=='D'){
f2[i+1]=0;
f1[i+1]=1;
}
}
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>yx[i][j];
for(int i=2;i<n;i++){
for(int j=2;j<n;j++){
if(yx[i][j]=='#')continue;
int a=j,b=i;
int c=j,d=i;
while(1){
a+=f2[l];
b+=f1[l];
if(yx[a][b]=='#'){
l=1;
break;
}
else cout<<a<<" "<<b<<"\n";
++l;
if(l>k){
o++;
l=1;
cout<<i<<" "<<j<<" "<<c<<" "<<d<<"\n";
break;
}
}
}
}
cout<<o;
return 0;
}