In an art class, students are learning about origami techniques. One student took a rectangular piece of paper and folded it several times. Then they made one hole in the folded paper using a hole punch. Now they want to know how many holes will appear in the original, unfolded sheet of paper.
The first line contains a single integer: the number of test cases.
Each test case begins with a line containing five integers: and — the right and top coordinates of the original paper; and — the coordinates of the hole in the folded state, and — the number of folds (0 \le R, T, HX, HY \le 10000, 0 \le F \le 8). The bottom-left corner of the paper has coordinates .
The next lines describe the sequence of folds. Each line contains a character and an integer (0 \le I \le 10000). If is "X", the fold is vertical: the right part is folded to the left along the line x = I. If is "Y", the fold is horizontal: the top part is folded downward along the line y = I.
A hole that lies on the border of the paper is considered to be inside the paper.
For each test case, print a single integer — the number of holes that will appear in the original, unfolded sheet of paper.
Example 3