//qqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzkqqzk
#pragma GCC optimize(3)
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>
#include <sstream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

// #define MP make_pair
// #define int long long
// #define us unsigned
//#define LL long long
const int N = 1000;
const int M = 2e5;
#define re register
// const int mod = 19260817;
// const int inf = 999999999;
// char buf[(int)1e8], *ss = buf;
// inline int init()
// {
//     buf[fread(buf, 1, (int)1e8 - 1, stdin)] = '\n';
//     fclose(stdin);
//     return 0;
// }
// const int __START__ = init();

int a, b, c, d, k[M + 10], sum[N + 10][N + 10], top, ans, p[N + 10][N + 10];
char t[N + 10][N + 10], op;
struct node
{
    int x, y;
} s[N * N + 10];

signed main()
{
    scanf("%d%d%d%d\n", &a, &b, &c, &d);
    for (re int i = 1; i <= a; i++)
        scanf("%s\n", t[i] + 1);
    int x = 1, y = 1;
    for (re int i = 1; i <= d; i++)
    {
        scanf("%c", &op);
        if (op == 'R')
        {
            y++;
            p[x][y]++;
        }
        if (op == 'L')
        {
            y--;
            p[x][y]++;
        }
        if (op == 'U')
        {
            x--;
            p[x][y]++;
        }
        if (op == 'D')
        {
            x++;
            p[x][y]++;
        }
    }
    for (re int k = 1; k <= b; k++)
        for (re int l = 1; l <= b; l++)
        {
            if (!p[k][l])
                continue;
            for (re int i = 1; k + i - 1 <= b; i++)
                for (re int j = 1; l + j - 1 <= b; j++)
                {
                    if (t[i][j] == 'X')
                        sum[k + i - 1][l + j - 1] += p[k][l];
                }
        }
    for (re int i = 1; i <= b; i++)
        for (re int j = 1; j <= b; j++)
            if (sum[i][j] >= c)
                ans++;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 7052