import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static public void main(String[] args) throws IOException {
BjSolution sol = new BjSolution();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int boardSize = Integer.parseInt(br.readLine());
int appleNum = Integer.parseInt(br.readLine());
int[][] appleTable = new int[appleNum][2];
for (int r = 0; r < appleNum; r++) {
String[] row = br.readLine().split(" ");
for (int i = 0; i < 2; i++) {
appleTable[r][i] = Integer.parseInt(row[i]);
}
}
int commandNum = Integer.parseInt(br.readLine());
String[][] commandTable = new String[commandNum][2];
for (int r = 0; r < commandNum; r++) {
commandTable[r] = br.readLine().split(" ");
}
sol.solution(boardSize, appleTable, commandTable);
}
}
class BjSolution {
int answer;
int[][] directions = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
public void solution(int boardSize, int[][] appleTable, String[][] commandTable) {
answer = 0;
Deque<Coordi> snake = new ArrayDeque<>();
Map<Coordi, Integer> appleMap = new HashMap<>();
for (int[] apple : appleTable) {
appleMap.put(new Coordi(apple[0] - 1, apple[1] - 1), 1);
}
Map<Integer, String> commandMap = new HashMap<>();
for (String[] command : commandTable) {
commandMap.put(Integer.parseInt(command[0]), command[1]);
}
snake.addLast(new Coordi(0, 0));
int snakeDirection = 1;
while (true) {
answer++;
Coordi snakeHead = snake.peekFirst();
int newRow = snakeHead.r + directions[snakeDirection][0];
int newCol = snakeHead.c + directions[snakeDirection][1];
Coordi newCoordi = new Coordi(newRow, newCol);
if (newCoordi.r < 0 || newCoordi.r >= boardSize
|| newCoordi.c < 0 || newCoordi.c >= boardSize) break;
if (snake.contains(newCoordi)) break;
snake.addFirst(newCoordi);
if (appleMap.remove(newCoordi) == null) {
snake.pollLast();
}
String newDirection = commandMap.get(answer);
if (newDirection == null) {
} else if (newDirection.equals("L")) {
snakeDirection = (snakeDirection + directions.length - 1) % directions.length;
} else if (newDirection.equals("D")) {
snakeDirection = (snakeDirection + directions.length + 1) % directions.length;
}
}
System.out.println(answer);
}
}
class Coordi {
int r, c;
public Coordi(int r, int c) {
this.r = r;
this.c = c;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Coordi coordi = (Coordi) o;
return r == coordi.r && c == coordi.c;
}
@Override
public int hashCode() {
return Objects.hash(r, c);
}
}