import java.io.*;
import java.util.*;
public class Main {
static int currD = 1;
static int[] dx = { -1, 0, 1, 0 };
static int[] dy = { 0, 1, 0, -1 };
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int N = Integer.parseInt(br.readLine());
int K = Integer.parseInt(br.readLine());
boolean[][] board = new boolean[N][N];
for (int i = 0; i < K; i++) {
st = new StringTokenizer(br.readLine(), " ");
board[Integer.parseInt(st.nextToken()) - 1][Integer.parseInt(st.nextToken()) - 1] = true;
}
int time = 0;
List<int[]> snake = new ArrayList<int[]>();
snake.add(new int[] { 0, 0 });
int L = Integer.parseInt(br.readLine());
int bx = 0;
String dir="";
end: for (int i = 0; i <= L; i++) {
int x = 10000;
if (i < L) {
st = new StringTokenizer(br.readLine(), " ");
x = Integer.parseInt(st.nextToken());
dir = st.nextToken();
} else {
bx = 0;
}
int cnt = 0;
here: while (cnt++ < x - bx) {
time++;
int[] cur = snake.get(snake.size() - 1);
int nx = cur[0] + dx[currD];
int ny = cur[1] + dy[currD];
if (0 <= nx && nx < N && 0 <= ny && ny < N && checkNoHit(nx, ny, snake)) {
snake.add(new int[] { nx, ny });
if (!board[nx][ny]) {
snake.remove(0);
} else {
board[nx][ny] = false;
}
} else {
break end;
}
}
bx = x;
selectDirection(dir);
}
System.out.println(time);
}
static int selectDirection(String d) {
if (d.equals("L")) {
currD -= 1;
} else if (d.equals("D")) {
currD += 1;
}
if (currD == -1) {
currD = 3;
} else if (currD == 4) {
currD = 0;
}
return currD;
}
static boolean checkNoHit(int nx, int ny, List<int[]> snake) {
for (int i = 0; i < snake.size(); i++) {
int[] s = snake.get(i);
if (nx == s[0] && ny == s[1])
return false;
}
return true;
}
}