H. Simai
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Hakurei Reimu is good at playing maimai DX.

In maimai DX, there are $$$8$$$ touch-sensitive buttons arranged in a circular layout around the screen. We number them from $$$1$$$ to $$$8$$$ (picture 1).

picture 1

One day, Reimu is studying simai language. We always use simai language to describe a slide. A slide contains three parts: starting point, ending point, and sliding path.

There are 4 kinds of slides in maimai DX:

  • $$$x-y$$$: The segment from $$$x$$$ to $$$y$$$ (picture 2 indicates $$$1-4$$$);
  • $$$x \gt y$$$: The circular arc clockwise from $$$x$$$ to $$$y$$$ (picture 3 indicates $$$2 \gt 5$$$);
  • $$$x \lt y$$$: The circular arc anticlockwise from $$$x$$$ to $$$y$$$ (picture 4 indicates $$$3 \lt 6$$$);
  • $$$x\lor y$$$: First the segment from $$$x$$$ to the center point, then the segment from the center point to $$$y$$$ (picture 5 indicates $$$1\lor 3$$$).

For example, there are $$$4$$$ slides in picture 6: $$$1 \gt 3,3\lor 5,1 \lt 7,7\lor 5$$$.

picture 6

Now we assume the radius of the maimai DX circle is $$$50$$$cm. Given a slide $$$x?y$$$, can you tell me the length of the slide?

Input

The first line consists of a positive integer $$$T\ (1\le T\le 10^5)$$$.

The next $$$T$$$ lines, each line contains $$$x?y\ (1\le x,y\le 8,\ x \neq y,\ ?\in\{-$$$, >, <, v$$$\})$$$.

Please note that we use the lowercase letter "v" instead of "$$$\lor$$$" in our input.

Output

$$$T$$$ lines, each line outputs the length of the slide.

The absolute or relative error within $$$10^{-6}$$$ is considered correct: Assuming the correct answer is $$$a$$$, your answer is $$$b$$$. It will be considered correct as long as $$$\frac{| a-b |}{max (a, 1)}\le 10^{-6}$$$.

Example
Input
4
1-4
2>5
3<6
1v3
Output
92.3879532511
117.8097245096
196.3495408494
100.0000000000
Note

Here are picture 2, picture 3, picture 4, and picture 5 from left to right: