#include<bits/stdc++.h>
using namespace std;
void __p(int x) {cerr<<x;}
void __p(long long x){cerr<<x;}
void __p(double x){cerr<<x;}
void _print(){cerr<<"]\n";}
template<typename T,typename... V>//定义类模版
void _print(T t,V... v){__p(t);if(sizeof...(v))cerr<<",";_print(v...);}
#define debug(x...) cerr<<"["<<#x<<"] = ["; _print(x)
#define see1 cout<<"*************\n";
#define see2 cerr<<"*************\n";
#define int long long
#define endl '\n'
const int N=2e5+10;
signed main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m,x,y;
cin>>n>>m>>x>>y;
map<int,set<int>>xy,yx;/*省去离散化处理,同时维护house的横纵坐标信息*/
for(int i=1;i<=n;i++){
int xx,yy; cin>>xx>>yy;
xy[xx].insert(yy);
yx[yy].insert(xx);
}
int ans=0;
for(int i=1;i<=m;i++){
char op; int d;
cin>>op>>d;
if(op=='U'){
int ny=y+d;
auto it=xy[x].lower_bound(y);
while(it!=xy[x].end()&&*it<=ny){
ans++;
yx[*it].erase(x);
it=xy[x].erase(it);
}
y=ny;
}else if(op=='D'){
int ny=y-d;
auto it=xy[x].lower_bound(ny);
while(it!=xy[x].end()&&*it<=y){
ans++;
yx[*it].erase(x);
it=xy[x].erase(it);
}
y=ny;
}else if(op=='R'){
int nx=x+d;
auto it=yx[y].lower_bound(x);
while(it!=yx[y].end()&&*it<=nx){
ans++;
xy[*it].erase(y);
it=yx[y].erase(it);
}
x=nx;
}else if(op=='L'){
int nx=x-d;
auto it=yx[y].lower_bound(nx);
while(it!=yx[y].end()&&*it<=x){
ans++;
xy[*it].erase(y);
it=yx[y].erase(it);
}
x=nx;
}
}
cout<<x<<' '<<y<<' '<<ans;
}
25/2/21