Dumbear loves numbers very much.
One day Dumbear found that each number can be expressed as a continued fraction. See below.
Formally, we say a number k can be expressed as a continued faction if
where a
0, a
1, …, a
n are positive integers except that a
0 maybe be 0 and a
n cannot be 1.
Dumbear also found a sequence which looks like the Farey sequence. Initially the sequenceand if we insert an elementbetween all the two adjacent element,in D
i, then we get a sequence D
i+1. So you can seeandAssume initially you are on the elementin D
0, and if now you are on the element k in D
i, then if you go left(‘L’)(or right(‘R’)) you will be on the left(or right) element of k in D
i+1. So a sequence composed of ‘L’ and ‘R’ denotes a number. Such as ‘RL’ denotes the number
Now give you a sequence composed of ‘L’ and ‘R’, you should print the continued fraction form of the number. You should use ‘-‘ to show the vinculum(the horizontal line), you should print one space both in front and back of ‘+’, and all parts up or down the vinculum should be right aligned. You should not print unnecessary space, ‘-‘ or other character. See details in sample.
There are several test cases in the input.
For each test case, there is a single line contains only a sequence composed of ‘L’ and ‘R’. The length of the sequence will not exceed 10000.
The input terminates by end of file marker.
For each test case, output the continued fraction form of the number which the input sequence denotes. The total amount of output will not exceed 4MB.