# 2078. TurtleGraphics

Your new graphical programming language Honu contains the primitives ‘L’ (turn left), ‘R’ (turn right), ‘U’ (turn up), ‘D’ (turn down), and ‘F’ (move forward), to describe the actions of a trail-leaving turtle in the three-dimensional sea. Only the ‘F’ command actually moves the turtle, and it always moves it one unit forward. All other commands simply change the orientation of the turtle. The turn commands all are with respect to the turtle’s current orientation. That is, ‘R’ means the turtle turns towards its current right side; ‘U’ means the turtle turns towards where its shell is facing.

In addition, commands can be repeated if they are immediately followed by a single digit from 1 to 9. So “F3” moves forward 3 units. There will not be adjacent digits in the command string. Digits may only follow the characters ‘U’, ‘D’, ‘R’, ‘L’, ‘F’, or ‘)’. The repeat count only applies to the immediately previous command, so “FF3” only advances four units.

Commands can also be grouped by parentheses. So “(FRFL)5” traces a zig-zag line, repeating “FRFL” five times.

Parentheses can be nested, so “((F2)2)2” moves forward 8 units.

Given a sequence of these commands, your method must return the Euclidean distance from where the turtle began to where it ended up.

-command will contain between 0 and 50 characters, inclusive.

-command will consist only of the characters ‘R’, ‘L’, ‘U’, ‘D’, and ‘F’, ‘(‘, ‘)’, and the digits ‘1’-‘9’.

-command will be properly formatted according to the description above.

### 输入格式

a sequence of commands.

### 输出格式

the Euclidean distance from where the turtle began to where it ended up.

### 样例

Input
FRF
FUFUFUF
FRFUF
F(((D)4)4)9F

Output
1.414214
0.000000
1.732051
2.000000


4 人解决，6 人已尝试。

6 份提交通过，共有 13 份提交。

7.6 EMB 奖励。