#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD1 = 1000000007;
const ll MOD2 = 1000000021;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

struct FFT{ // just call multiply
    typedef pair<double, double> com;
    int n;
    vector<com> a, b;
    vector<com> f[2];
    void init(vector<int>& p, vector<int>& q, int x){
        n = 1;
        while(n < x) n *= 2;
        a.resize(n, com(0,0));
        b.resize(n, com(0,0));
        rep(i,2) f[i].resize(n, com(0,0));
        rep(i,p.size()) a[i] = com(p[i],0);
        rep(i,q.size()) b[i] = com(q[i],0);
    }

    inline com com_add (com a, com b) {
        return com(a.first+b.first, a.second+b.second);
    }

    inline com com_mul (com a, com b) {
        return com(a.first*b.first-a.second*b.second, a.first*b.second+a.second*b.first);
    }
    
    vector<com> dft(vector<com>& v, bool rev){
        int x = n, u = 0;
        f[0] = v;
        int ho = 0, ge = 1;
        for(int i = 2; i <= n; i <<= 1){
            u++; x >>= 1;
            com zeta;
            if(!rev) zeta = com(cos(2*PI/i),sin(2*PI/i));
            else zeta = com(cos(2*PI/i),-sin(2*PI/i));
            com pz;
            rep(j,x){
                pz = com(1,0);
                rep(k,i){
                    if(k>=i/2) f[ge][j*i+k] = com_add(f[ho][j*(i/2)+k-i/2],com_mul(pz,f[ho][j*(i/2)+n/2+k-i/2]));
                    else f[ge][j*i+k] = com_add(f[ho][j*(i/2)+k],com_mul(pz,f[ho][j*(i/2)+n/2+k]));
                    pz = com_mul(pz, zeta);
                }
            }
            swap(ho,ge);
        }
        return f[ho];
    }
    
    vector<com> multiply(vector<int>& p, vector<int>& q){ // x: max degree
        a.clear(); b.clear(); f[0].clear(); f[1].clear();
        int x = p.size() + q.size()+1;
        init(p,q,x);
        a = dft(a,0);
        b = dft(b,0);
        rep(i,n) a[i] = com_mul(a[i],b[i]);
        a = dft(a,1);
        rep(i,n) a[i] = com(a[i].first/n, a[i].second/n);
        return a;
    }
} fft;

int N, M, K, L;
vector<string> inp;
vector<int> pat;
string s;
vector<int> cnt;

int main() {
    cin >> N >> M >> K >> L;
    inp.assign(N, "");
    rep(i,N) cin >> inp[i];
    pat.assign(M*M,0);
    rep(i,N) rep(j,N) {
        if (inp[i][j] == 'X') pat[i*M+j] = 1;
    }
    cin >> s;
    pi pos = pi(0,0);
    cnt.assign(M*M, 0);
    rep(i,s.size()) {
        if (s[i] == 'R') pos.second++;
        if (s[i] == 'L') pos.second--;
        if (s[i] == 'U') pos.first--;
        if (s[i] == 'D') pos.first++;
        cnt[pos.first*M+pos.second]++;
    }
    vector<pair<double, double>> f = fft.multiply(pat, cnt);
    int ans = 0;
    rep(i,M) {
        rep(j,M) {
            if (round(f[i*M+j].first) >= K) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 46828