// Born_To_Laugh - Hughie Do
#include <bits/stdc++.h>
#define alle(AC) AC.begin(), AC.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
[[maybe_unused]] const int MOD = 998244353, INF = 1e9 + 7;
const int maxn = 510;
int n, m, k;
bitset<510> bs[maxn], inp[maxn], nxt[maxn];
void solve(){
cin >> n >> m >> k;
for(int i=1; i<=n; ++i){
for(int j=m-1; j>=0; --j){
char x;cin >> x;
if(x == '#'){
inp[i][j] = bs[i][j] = 0;
}
else inp[i][j] = bs[i][j] = 1;
}
}
while(k--){
char x;cin >> x;
if(x == 'W'){
for(int i=1; i<=n; ++i)
bs[i] = (bs[i] << 1) & inp[i];
}
if(x == 'E'){
for(int i=1; i<=n; ++i)
bs[i] = (bs[i] >> 1) & inp[i];
}
if(x == 'N'){
for(int i=1; i<=n; ++i)
bs[i] = bs[i + 1] & inp[i];
}
if(x == 'S'){
for(int i=n; i>=1; --i)
bs[i] = bs[i - 1] & inp[i];
}
if(x == '?'){
for(int i=1; i<=n; ++i){
nxt[i] = (bs[i] << 1) | (bs[i] >> 1) | bs[i + 1] | bs[i - 1];
}
for(int i=1; i<=n; ++i)
bs[i] = nxt[i] & inp[i];
}
}
int ans = 0;
for(int i=1; i<=n; ++i) ans += bs[i].count();
cout << ans << '\n';
}
signed main(){
// freopen("inp.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}