#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)6e18
#define pii pair<ll,ll>
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define rev(v)  if(!v.empty())reverse(v.begin(),v.end())
#define PI 3.141592653589793238
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

const ll N=(ll)3e5;
ll inv[N];
ll fac[N];

void init(){
  fac[0]=1;
  
  for(ll i=1;i<N;i++)
  fac[i]=(i*fac[i-1])%mod;
  
  for(ll i=0;i<N;i++)
  inv[i]=inv_mod(fac[i]);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;
    
    if(n==r||r==0)
    return 1LL;
    
    ll x=fac[n];
    ll y=inv[n-r];
    ll z=inv[r];
    
    return ((x*y)%mod*z)%mod;
}
bool test_cases=0;

string simplify(string &s){
	stack<char>st;
	ll n=s.size();
	string ans;
	for(ll i=0;i<n;i++){
		 if(st.empty())
		 st.push(s[i]);
		 else if(st.top()==s[i])
		 st.pop();
		 else
		 st.push(s[i]);
	}
	
	while(!st.empty())
	{
		ans+=st.top();
		st.pop();
	}
	
	rev(ans);
	
	return ans;
}
void solve()
{
    string s;
    cin>>s;
    
    ll n=s.size();
    
    string ans;
    
    
    deque<char>dq;
    
    ll x=0;
    
    for(ll i=0;i<n;i++){
    	 if(s[i]=='R')
    	 x^=1;
    	 else{
    	 	if(x==1)
    	 	dq.push_front(s[i]);
    	 	else
    	 	dq.pb(s[i]);
		 }
	}
	
	while(!dq.empty()){
		ans+=dq.front();
		dq.pop_front();
	}
	
	if(x)
	rev(ans);
	
	ans=simplify(ans);
	
	///cout<<ans<<endl;
    cout<<ans<<endl;
}
int main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
   
   // init();   //factorial calculations
   
   //Start from Here.

  ll t;
  t=1;
  
  if(test_cases)
  cin>>t;
  
  while(t--)
  solve();
//Good Bye!
    return 0;
}

#include <stdio.h>

#include <vector>

#define cm (1 << 17)
char cn[cm], *ci = cn + cm, ct;

inline char getcha() {
  if (ci - cn == cm) {
    fread(cn, 1, cm, stdin);
    ci = cn;
  }
  return *ci++;
}

inline int getint() {
  int A = 0;
  while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
  return A;
}

int main() {
  int h = getint(), w = getint(), n = getint(), m = getint();
  using std::vector;
  vector<vector<bool>> g1(h, vector<bool>(w, 0)), g2(h, vector<bool>(w, 0)),
      res(h, vector<bool>(w, 0));
  for (int i = 0; i < n; i++) {
    g1[getint() - 1][getint() - 1] = 1;
  }
  for (int i = 0; i < m; i++) {
    g2[getint() - 1][getint() - 1] = 1;
  }
  for (int i = 0; i < h; i++) {
    bool flag = 0;
    for (int j = 0; j < w; j++) {
      if (g2[i][j]) {
        flag = 0;
      } else if (g1[i][j]) {
        flag = 1;
        for (int jj = j - 1; ~jj; jj--) {
          if (g1[i][jj] || g2[i][jj]) break;
          res[i][jj] = 1;
        }
      }
      if (flag) res[i][j] = 1;
    }
  }
  for (int j = 0; j < w; j++) {
    bool flag = 0;
    for (int i = 0; i < h; i++) {
      if (g2[i][j]) {
        flag = 0;
      } else if (g1[i][j]) {
        flag = 1;
        for (int ii = i - 1; ~ii; ii--) {
          if (g1[ii][j] || g2[ii][j]) break;
          res[ii][j] = 1;
        }
      }
      if (flag) res[i][j] = 1;
    }
  }
  int ans = 0;
  for (auto&& v : res) {
    for (auto&& e : v) {
      if (e) ans++;
    }
  }
  printf("%d", ans);
  return 0;
}