#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
#define MOD 924844033
#define root 5
int add(const int x, const int y){
    return (x + y  < MOD) ? x + y : x + y - MOD;
}
int mul(const int x, const int y){
    return (long long) x * y % MOD;
}
int power(int x, int n){
    int res = 1;
    while(n > 0){
        if(n & 1){
            res = mul(res, x);
        }
        x = mul(x ,x);
        n >>= 1;
    }
    return res;
}
int inverse(const int x){
    return power(x, MOD - 2);
}
void ntt(vector<int> &a, const bool rev = false){
    int i,j,k,s,t,v,w,wn;
    const int size = (int) a.size();
    const int height = (int)log2(2 * size - 1);
    for(i = 0; i < size; i++){
        j = 0;
        for(k = 0; k < height; k++){
            j |= (i >> k & 1) << (height - 1 -k);
        }
        if(i < j)swap(a[i], a[j]);
    }
    for(i = 1; i < size; i*= 2){
        w = power(root, (MOD - 1) / (i * 2));
        if(rev) w = inverse(w);
        for(j = 0; j < size; j+= i * 2){
            wn = 1;
            for(k = 0; k < i; k++){
                s = a[j + k + 0], t = mul(a[j+k+i],wn);
                a[j+k+0] = add(s, t);
                a[j+k+i] = add(s, MOD-t);
                wn = mul(wn, w);
            }
        }
    }
    if(rev){
        v = inverse(size);
        for(i = 0; i < size; i++){
            a[i] = mul(a[i], v);
        }
    }
}

vector<int> convolute(const vector<int> & a, const vector<int> &b){
    const int size = (int) a.size() + (int) b.size() - 1;
    int t = 1;
    while(t < size){
        t <<= 1;
    }
    vector<int> A(t,0),B(t,0);
    for(int i = 0 ; i < (int) a.size(); i++){
        A[i] = a[i];
    }
    for(int i = 0; i < (int) b.size(); i++){
        B[i] = b[i];
    }
    ntt(A),ntt(B);
    for(int i = 0; i < t; i++){
        A[i] = mul(A[i], B[i]);
    }
    ntt(A,true);
    A.resize(size);
    return A;
}


int main(){
    int n,m,k,l;
    cin >> n >> m >> k >> l;
    vector<int> a(m*m);
    vector<int> b(m*m);
    vector<string> s(n);
    rep(i,n){
        cin >> s[i];
        while(s[i].size()!=m){
            s[i].push_back('.');
        }    
    }
    string tmp;
    rep(i,m){
        tmp.push_back('.');
    }
    while(s.size()!=m){
        s.push_back(tmp);
    }
    rep(i,m){
        rep(j,m){
            if(s[i][j]=='X'){
                b[i*m+j] = 1;
            }
        }
    }
    string p;
    cin >> p;
    int x = 0,y=0;
    rep(i,p.size()){
        if(p[i]=='R'){
            x++;
            a[y*m+x]++;
        }else if(p[i]=='D'){
            y++;
            a[y*m+x]++;
        }else if(p[i]=='L'){
            x--;
            a[y*m+x]++;
        }else{
            y--;
            a[y*m+x]++;
        }
    }
    vector<int> res = convolute(a,b);
    int sm = 0;
    // rep(i,m*m){
    //     cerr << a[i] << " ";
    // }
    // cerr << endl;
    // rep(i,m*m){
    //     cerr << b[i] << " ";
    // }
    // cerr << endl;
    rep(i,res.size()){
        //cerr << res[i] << endl;
        if(res[i]>=k){
            sm++;
        }
    }
    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 9440