ICPC World Finals Day 5

Mr. Tee got lost in the city of R country. The trouble is that the streets are similar, so I have no idea where I am now. Country R is "sorry", so you have to return to the hotel before being attacked by the enemy. Fortunately, I only remember how it turned, so let's go random.

problem

\\ (w \ times h \\) There is a two-dimensional grid-like map of squares. Let the coordinates of the upper left cell be \\ ((1, 1) \\) and the coordinates of the lower right cell be \\ ((w, h) \\). The map is surrounded by walls, and \\ (n \\) obstacles are coordinated \\ ((x_ {i}, y_ {i}) (1 \ leq i \ leq n) \\) Is placed in. In addition, the instruction sequence \\ (r_ {1} r_ {2} \ cdots r_ {m} \\) and the target coordinates \\ ((g_ {x}, g_ {y}) \\) are given. After setting the start coordinates and the direction of travel, the pedestrian starts walking according to the following movement rules.

1. Initialize the counter to \\ (i = 1 \\) and set the start coordinates and travel direction (up / down / left / right).
2. Go straight until you meet a wall / obstacle.
3. Do one of the following in front of the wall / obstacle.
3. a. \\ (i> m \\), that is, end walking if there is no command.
3. b. If the command \\ (r_ {i} \\) is L, turn left, and if R, turn right.
4. Increment \\ (i \\).
5. Return to 2.

If the coordinates (including the start coordinates) passed from the start of walking to the end of walking include the target coordinates \\ ((g_ {x}, g_ {y}) \\), the pedestrian has reached the destination. Interpret as. Find out how many combinations of start coordinates and travel directions can reach your destination. However, it is assumed that obstacles and coordinates outside the map cannot be set as the start coordinates. (The target coordinates can be set.)

input


w h gx gy n
x1 y1
...
xn yn
r1r2… rm


Map width \\ (w \\), height \\ (h \\), destination x coordinate \\ (g_ {x} \\), destination y coordinate \\ (g_) on the first line {y} \\), the number of obstacles \\ (n \\) are given separated by blanks. From the second line to the \\ (n + 1 \\) line, the coordinates of each obstacle \\ ((x_ {i}, y_ {i}) \\) are given separated by blanks. The instruction column \\ (r_ {1} r_ {2} \ cdots r_ {m} \\) of length \\ (m \\) is given in the \\ (n + 2 \\) line.

output

Output the number of combinations of starting coordinates and traveling directions on one line so that you can reach your destination.

Constraint

* All inputs are integers
* \\ (2 \ leq w, h \ leq 10 ^ {5} (= 100000) \\)
* \\ (0 \ leq n \ leq 10 ^ {5} (= 100000) \\)
* \\ (1 \ leq g_ {x}, x_ {i} \ leq w \\)
* \\ (1 \ leq g_ {y}, y_ {i} \ leq h \\)
* \\ ((x_ {i}, y_ {i}) \ not = (g_ {x}, g_ {y}) (1 \ leq i \ leq n) \\)
* \\ ((x_ {i}, y_ {i}) \ not = (x_ {j}, y_ {j}) (i \ not = j) \\)
* \\ (r_ {i} \ in \\ {L, R \\} (1 \ leq i \ leq m) \\)
* \\ (1 \ leq m \ leq 20 \\)



Input / output example

Input 1


3 3 3 2 2
1 1
twenty two
RL


Output 1


9


In addition to the following 5 types of walking, walking (4 types) starting from the target coordinates passes through the target coordinates.

http://k-operafan.info/static/uecpc2013/files/lost_sample_1.png

Input 2


4 4 3 1 4
1 1
3 2
13
4 3
RR


Output 2


13


Walking starting from the following start coordinates / traveling direction passes through the target coordinates.

http://k-operafan.info/static/uecpc2013/files/lost_sample_2.png

Input 3


100000 100000 46597 49716 17
38713 77141
46598 78075
66177 49715
58569 77142
48303 12742
32829 65105
32830 78076
70273 27408
48302 21196
27119 54458
38714 65104
46598 54457
27118 12743
60242 21197
60241 1101
58568 27409
93581 1100
LLRRLLLLRRLL


Output 3


647505






Example

Input

w h g


Output

9
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Get Lost
public class Main{
	Scanner sc=new Scanner(System.in);

	int w, h, gx, gy, n;
	int[] xs, ys;
	String run;

	void run(){
		w=sc.nextInt();
		h=sc.nextInt();
		gx=sc.nextInt()-1;
		gy=sc.nextInt()-1;
		n=sc.nextInt();
		xs=new int[n];
		ys=new int[n];
		for(int i=0; i<n; i++){
			xs[i]=sc.nextInt()-1;
			ys[i]=sc.nextInt()-1;
		}
		run=sc.next()+"$";
		solve();
	}

	void solve(){
		long sum=0;
		for(int d=0; d<4; d++){
			sum+=solve1();
			int ngx=h-1-gy, ngy=gx;
			gx=ngx;
			gy=ngy;
			for(int i=0; i<n; i++){
				int nx=h-1-ys[i], ny=xs[i];
				xs[i]=nx;
				ys[i]=ny;
			}
			int t=w;
			w=h;
			h=t;
		}
		println(sum+"");
	}

	TreeSet<Integer>[] sets1, sets2;

	@SuppressWarnings("unchecked")
	long solve1(){
		sets1=new TreeSet[w];
		for(int i=0; i<w; i++){
			sets1[i]=new TreeSet<Integer>();
			sets1[i].add(-1);
			sets1[i].add(h);
		}
		sets2=new TreeSet[h];
		for(int i=0; i<h; i++){
			sets2[i]=new TreeSet<Integer>();
			sets2[i].add(-1);
			sets2[i].add(w);
		}

		for(int i=0; i<n; i++){
			sets1[xs[i]].add(ys[i]);
			sets2[ys[i]].add(xs[i]);
		}
		sets1[gx].add(gy);
		sets2[gy].add(gx);

		long sum=1;
		for(int x=0; x<w; x++){
			int py=-2;
			for(int y : sets1[x]){
				int sy=y-1;
				if(sy!=py){
					if(ok(x, sy, 0)){
						// [py+1, y-1]
						sum+=y-py-1;
					}
				}
				py=y;
			}
		}
		return sum;
	}

	boolean ok(int x, int y, int d){
		for(int k=0; k<run.length(); k++){
			int wx, wy; // wall or goal
			int nx, ny; // next point
			if(d==0){
				wx=nx=x;
				wy=sets1[x].higher(y);
				ny=wy-1;
			}else if(d==1){
				wy=ny=y;
				wx=sets2[y].lower(x);
				nx=wx+1;
			}else if(d==2){
				wx=nx=x;
				wy=sets1[x].lower(y);
				ny=wy+1;
			}else{
				assert d==3;
				wy=ny=y;
				wx=sets2[y].higher(x);
				nx=wx-1;
			}
			if(wx==gx&&wy==gy){
				return true;
			}
			x=nx;
			y=ny;
			if(run.charAt(k)=='L'){
				d=(d+3)%4;
			}else if(run.charAt(k)=='R'){
				d=(d+1)%4;
			}
		}
		return false;
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}