Blue and Orange are friendly robots. An evil computer mastermind has locked them up in separate hallways to test them, and then possibly give them cake.
Each hallway contains buttons labeled with the positive integers . Button is always meters from the start of the hallway, and the robots both begin at button . Over the period of one second, a robot can walk one meter in either direction, or it can press the button at its position once, or it can stay at its position and not press the button. To complete the test, the robots need to push a certain sequence of buttons in a certain order. Both robots know the full sequence in advance. How fast can they complete it?
For example, let's consider the following button sequence:
O , B , B , O
Here, O means button in Orange's hallway, B means button in Blue's hallway, and so on. The robots can push this sequence of buttons in seconds using the strategy shown below:
Time
Orange
Blue
Move to button
Stay at button
Push button
Move to button
Push button
Move to button
Move to button
Stay at button
Push button
Push button
Stay at button
Note that Blue has to wait until Orange has completely finished pushing O before it can start pushing B .
输入格式
The first line of the input gives the number of test cases, . test cases follow.
Each test case consists of a single line beginning with a positive integer , representing the number of buttons that need to be pressed. This is followed by terms of the form "" where is a robot color (always 'O' or 'B'), and is a button position.
输出格式
For each test case, output one line containing "Case #x: y", where is the case number (starting from 1) and is the minimum number of seconds required for the robots to push the given buttons, in order.