Special Moves#11804

Special Moves

1 second
256 megabytes
Easy

You are given a string of length , consisting of the letters , , , . Each letter represents a direction of movement on a coordinate plane. Initially, you are at the point . You need to determine the number of special points during the process; the movement rules for each direction are as follows:

You need to process the string in the order it is given and simulate the movements, determining the number of special points.

A point is called special if its visitation frequency is the highest.

Input

The first line contains an integer (1 \le t \le 10^5) — the number of test cases in a single input file.

Each test case is described in two lines. The first line contains integers , , — the length of the string and the coordinates of the starting point (1 \le n \le 2 \cdot 10^5), (-10^9 \le x, y \le 10^9).

The second line contains the string of length (s_i \in \{\mathtt{R}, \mathtt{L}, \mathtt{D}, \mathtt{U}\}).

It is guaranteed that the sum of across all test cases does not exceed 2 \cdot 10^5.

Output

For each test case, output the number of special points.

Examples

Example 1

Loading
Loading

Note

In the first test case, the process looks like this:

  1. Initially, we are at .

  2. We move left, so we are at .

  3. We move up, so we are at .

  4. We move down, so we are at .

  5. We move up again, so we are at .

  6. We move down again, so we are at .

Here, the most visited point is , and it was visited times. Only one point among all was visited times.

In the second test case, the process looks like this:

  1. Initially, we are at .

  2. We move left, so we are at .

  3. We move right, so we are at .

  4. We move left, so we are at .

  5. We move down, so we are at .

Here, the most visited points are and , and they were visited times, so the answer is .

Scoring

  1. ( points): n \le 2;

  2. ( points): s_i \in \{\mathtt{L}, \mathtt{R}\};

  3. ( points): (-100 \le x, y \le 100) - This is guaranteed at any point of the process;;

  4. ( points): (1 \le \sum n \le 500) ;

  5. ( points): no additional constraints;