/**
*    author: zakhio (mttk1528)
*    created: 31.01.2021 15:25:52
**/
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;

#define dump(x) cout << #x << " = " << (x) << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define len(x) (int)(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pcnt __builtin_popcount
#define rup(x, y) ((x + y - 1) / (y))

using str = string;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using pii = pair<int,int>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using pldld = pair<ld,ld>;
// using bint = boost::multiprecision::cpp_int;

constexpr ld PI = M_PI;
constexpr ld EPS = 1e-10;
constexpr ll LINF = 1e18;
constexpr int INF = 1e9;
constexpr int MAX = 2000020;
constexpr int MOD1 = 1000000007;
constexpr int MOD2 = 998244353;
const int di[4] = {1, 0, -1, 0};
const int dj[4] = {0, 1, 0, -1};
const int di2[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj2[8] = {1, 0, -1, 0, 1, -1, 1, -1};

constexpr ld radian_to_degree(ld r) { return (r * 180.0 / PI); }
constexpr ld degree_to_radian(ld d) { return (d * PI / 180.0); }
inline bool eq(ld lhs, ld rhs) { return std::fabs(lhs - rhs) < EPS; }
inline void print() { cout << endl; return; }

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail)) cout << " "; print(forward<Tail>(tail)...); }
template <typename T, typename U> inline bool chmax(T &lhs, U rhs) { if (lhs < rhs) { lhs = rhs; return true; } return false; }
template <typename T, typename U> inline bool chmin(T &lhs, U rhs) { if (lhs > rhs) { lhs = rhs; return true; } return false; }
template <typename T> inline T gcd_all(vector<T> &v) { return reduce(all(v), v[0], [] (T x, T y) { return gcd(x, y); }); }
template <typename T> inline T lcm_all(vector<T> &v) { return reduce(all(v), v[0], [] (T x, T y) { return lcm(x, y); }); }
template <typename T> inline T bpow(T a, int n) { T r(1); while (n) { if (n & 1) r *= a; a *= a; n >>= 1; } return r; }
template <typename T> inline auto comp(vector<T> v) { sort(all(v)); v.erase(unique(all(v)), v.end()); return v; }
template <typename T> inline string join(string s, vector<T> v) { string t = ""; rep(i, len(v)) { if (i) t += s; t += to_string(v[i]); } return t; }
template <typename T> inline ld eucdist(pair<T,T> x, pair<T,T> y) { return hypotl(x.first - y.first, x.second - y.second); }

template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T,U> &p) { return os << p.first << " " << p.second;}
template <typename T, typename U> istream &operator>>(istream &is, pair<T,U> &p) { return is >> p.first >> p.second; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { rep(i, len(v)) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { int c(0); for (auto &x : st) { if (c) os << " "; os << x; c++; } return os;}



void solve() {

    int n; cin >> n;
    ll tnum = 1, fnum = 1;
    rep(i, n) {
        string s; cin >> s;
        if (s == "OR") {
            tnum += tnum + fnum;
        }
        else {
            fnum += tnum + fnum;
        }
    }
    print(tnum);

    return;
}

int main() {

    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);

    solve();

    return 0;
}
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


//////////////////////////////////////
#include <iostream>
using namespace std;
#define dp(arg) do { cout << #arg << ":"; dprint(arg); } while(0)

template <typename T> void dprint(T arg) { cout << arg << "\n"; }
template <typename T> void dprint(const vector<T>& arg) { for_each(begin(arg), end(arg), [](T value){ cout << value << " "; }   ); cout << "\n";  }
template <typename T> void dprint(const vector<vector<T>>& arg) { for_each(begin(arg), end(arg), [=](vector<T> arg2){ dprint(arg2); cout << "\n";} );  }


//////////////////////////////////////
#define ll long long int

// sigma 1 to n
ll sigma1(ll n){
    return n*(n+1)/2;
}


int main(int argc, char *argv[]) {
    int h,w, n, m;
    cin >> h>>w >> n>> m;
    int maze[h][w];
    int visited[h][w][4];
    REP(hh,h){
        REP(ww, w){
            maze[hh][ww] = 0;
            visited[hh][ww][0] = 0;
            visited[hh][ww][1] = 0;
            visited[hh][ww][2] = 0;
            visited[hh][ww][3] = 0;
        }
    }
    vector<int> data;
    vector<int> datb;
    vector<int> datc;
    vector<int> datd;
    int a,b,c,d;
    REP(i, n){ cin >>a>>b; --a;--b; data.push_back(a); datb.push_back(b); }
    REP(i, m){ cin >>c>>d; --c;--d; maze[c][d] = 1; }
    int dh[4] = {-1, 0, 1,0};
    int dw[4] = {0, 1, 0, -1};
    int oa, ob, nh, nw;
    int flag;
    REP(iii, n){
        oa = data[iii];
        ob = datb[iii];
        a = oa;
        b = ob;
        maze[a][b] = 2;
        REP(dir, 4){
            a = oa;
            b = ob;
            //cout << "cnt" << a << b << dir<< endl;
            flag = 1;
            while(flag) {
                //cout << "gogo" << a << b << dir<< endl;
                maze[a][b] = 2;
                if(visited[a][b][dir] == 1) break;
                visited[a][b][dir] = 1;
                nh = a + dh[dir];
                nw = b + dw[dir];
                if (nh < 0 || (h - 1) < nh)  break;
                if (nw < 0 || (w - 1) < nw)  break;
                if (maze[nh][nw] != 1 && visited[nh][nw][dir] == 0){
                    a = nh;
                    b = nw;
                } else break;
            }

        }
    }
    int res = 0;
    REP(hh,h){
        REP(ww, w){
            if(maze[hh][ww] == 2){
                res++;
            }
        }
    }
    cout << res;

}
