#include <bits/stdc++.h>
using namespace std;

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(a>b)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream&os, const pair<t,u>&p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream&operator <<(ostream&os,const vc<t>&v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class t>
void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

const int inf=LLONG_MAX/3;

using uint=unsigned;
using ull=unsigned long long;
const uint mod=998244353;
struct mint{
	uint v;
	mint(ll vv=0){s(vv%mod+mod);}
	mint&s(uint vv){
		v=vv<mod?vv:vv-mod;
		return *this;
	}
	mint operator-()const{return mint()-*this;}
	mint&operator+=(const mint&r){return s(v+r.v);}
	mint&operator-=(const mint&r){return s(v+mod-r.v);}
	mint&operator*=(const mint&r){
		v=ull(v)*r.v%mod;
		return *this;
	}
	mint&operator/=(const mint&r){return *this*=r.inv();}
	mint operator+(const mint&r)const {return mint(*this)+=r;}
	mint operator-(const mint&r)const {return mint(*this)-=r;}
	mint operator*(const mint&r)const {return mint(*this)*=r;}
	mint operator/(const mint&r)const {return mint(*this)/=r;}
	mint pow(int n)const{
		mint res=1,x=*this;
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}
	mint inv()const{return pow(mod-2);}
	friend ostream&operator<<(ostream&os,const mint&m){
		return os<<m.v;
	}
};

const mint proot=3;
void inplace_fmt(vc<mint>&f,const bool inv){
	dmp(f);
	const int n=f.size();
	const mint root=inv?proot.inv():proot;
	vc<mint> g(n);
	for(int b=n/2;b>=1;b/=2){
		mint w=root.pow((mod-1)/(n/b)),p=1;
		for(int i=0;i<n;i+=b*2){
			rep(j,b){
				f[i+j+b]*=p;
				g[i/2+j]=f[i+j]+f[i+b+j];
				g[n/2+i/2+j]=f[i+j]-f[i+b+j];
			}
			p*=w;
		}
		swap(f,g);
	}
	if(inv){
		mint w=mint(1)/n;
		rep(i,n)f[i]*=w;
	}
	dmp(f);
}

void waf(int s,vc<mint>&a,bool inv){
	rep(i,s){
		vc<mint> b(s);
		rep(j,s)b[j]=a[i*s+j];
		inplace_fmt(b,inv);
		rep(j,s)a[i*s+j]=b[j];
	}
	//dmp(a);
	rep(i,s){
		vc<mint> b(s);
		rep(j,s)b[j]=a[i+j*s];
		inplace_fmt(b,inv);
		rep(j,s)a[i+j*s]=b[j];
	}
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	int n,m,k,l;cin>>n>>m>>k>>l;
	int s=512;
	//int s=32;
	//int s=8;
	vc<mint> x(s*s);
	rep(i,n){
		string b;cin>>b;
		rep(j,n)
			x[i*s+j]=b[j]=='X';
	}
	vc<mint> y(s*s);
	{
		int i=0,j=0;
		string w;cin>>w;
		for(auto c:w){
			if(c=='U')i--;
			if(c=='D')i++;
			if(c=='L')j--;
			if(c=='R')j++;
			y[i*s+j]+=1;
		}
	}
	//dmp(x);
	//dmp(y);
	waf(s,x,false);
	waf(s,y,false);
	rep(i,s*s)x[i]*=y[i];
	waf(s,x,true);
	int ans=0;
	rep(i,s*s)if(x[i].v>=k)ans++;
	//dmp(x);
	cout<<ans<<endl;
}



Measured memory_bytes: 5464