From prefix to infix#731

From prefix to infix

1 second
256 megabytes
Medium

In the 1920s, the Polish mathematician Jan Łukasiewicz introduced a bracket-free notation for writing algebraic expressions, which became known as Polish notation in his honor. In prefix Polish notation, the operator is placed before its operands. For example, for the infix expression (b-c/d)/(e*f-(g+h*k)) , the fragment becomes in prefix form, and b-c/d becomes . Similarly, e*f becomes , h*k becomes , and g+h*k becomes +g*hk . Thus, the expression e*f-(g+h*k) translates to -*ef+g*hk , and considering these prefix notations as operands for the final operation (division), we obtain: /-b/cd-*ef+g*hk .

Your task is to convert a given prefix expression into its corresponding infix expression, following these conditions:

  1. All operands from the given expression appear in the infix form in the same order as in the original expression.

  2. Parentheses are used only when necessary (that is, if the meaning of the expression would be different without them).

Input

The input consists of a single line containing the prefix expression.

The expression contains no spaces, operands are lowercase Latin letters, and only binary operations , , , are used. The length of the expression does not exceed . It is guaranteed that the expression is valid.

Output

The output should be a single line containing the resulting infix expression.

Examples

Example 1

Loading
Loading