#D12743. Points and Lines

    ID: 10598 Type: Default 8000ms 536MiB

Points and Lines

Points and Lines

Problem Statement

One day, you found an old scroll with strange texts on it.

You revealed that the text was actually an expression denoting the position of treasure. The expression consists of following three operations:

  • From two points, yield a line on which the points lie.
  • From a point and a line, yield a point that is symmetric to the given point with respect to the line.
  • From two lines, yield a point that is the intersection of the lines.

The syntax of the expression is denoted by following BNF:

::= ::= | "@" | "@" | "@" ::= "(" "," ")" | "(" ")" ::= | "@" ::= "(" ")" ::= | | ::= | ::= "-" ::= | ::= "0" ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

Each or denotes a point, whereas each or denotes a line. The former notion of (X,Y)(X,Y) represents a point which has XX for xx-coordinate and YY for yy-coordinate on the 22-dimensional plane. "@" indicates the operations on two operands. Since each operation is distinguishable from others by its operands' types (i.e. a point or a line), all of these operations are denoted by the same character "@". Note that "@" is left-associative, as can be seen from the BNF.

Your task is to determine where the treasure is placed.

Input

The input consists of multiple datasets. Each dataset is a single line which contains an expression denoting the position of treasure.

It is guaranteed that each dataset satisfies the following conditions:

  • The length of the string never exceeds 10210^2.
  • If both operands of "@" are points, their distance is greater than 11.
  • If both operands of "@" are lines, they are never parallel.
  • The absolute values of points' coordinates never exceed 10210^2 at any point of evaluation.

You can also assume that there are at most 100100 datasets.

The input ends with a line that contains only a single "#".

Output

For each dataset, print the XX and YY coordinates of the point, denoted by the expression, in this order.

The output will be considered correct if its absolute or relative error is at most 10210^{-2}.

Sample Input

((0,0)@(1,1))@((4,1)@(2,5)) ((0,0)@(3,1))@((1,-3)@(2,-1)) (0,0)@(1,1)@(4,1) (0,0)@((1,1)@(4,1)) (((0,0)@((10,20)@(((30,40)))))) ((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100)

Output for the Sample Input

3.00000000 3.00000000 3.00000000 1.00000000 1.00000000 4.00000000 0.00000000 2.00000000 -10.00000000 10.00000000 -99.83681795 -91.92248853

Example

Input

((0,0)@(1,1))@((4,1)@(2,5)) ((0,0)@(3,1))@((1,-3)@(2,-1)) (0,0)@(1,1)@(4,1) (0,0)@((1,1)@(4,1)) (((0,0)@((10,20)@(((30,40)))))) ((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100)

Output

3.00000000 3.00000000 3.00000000 1.00000000 1.00000000 4.00000000 0.00000000 2.00000000 -10.00000000 10.00000000 -99.83681795 -91.92248853

inputFormat

Input

The input consists of multiple datasets. Each dataset is a single line which contains an expression denoting the position of treasure.

It is guaranteed that each dataset satisfies the following conditions:

  • The length of the string never exceeds 10210^2.
  • If both operands of "@" are points, their distance is greater than 11.
  • If both operands of "@" are lines, they are never parallel.
  • The absolute values of points' coordinates never exceed 10210^2 at any point of evaluation.

You can also assume that there are at most 100100 datasets.

The input ends with a line that contains only a single "#".

outputFormat

Output

For each dataset, print the XX and YY coordinates of the point, denoted by the expression, in this order.

The output will be considered correct if its absolute or relative error is at most 10210^{-2}.

Sample Input

((0,0)@(1,1))@((4,1)@(2,5)) ((0,0)@(3,1))@((1,-3)@(2,-1)) (0,0)@(1,1)@(4,1) (0,0)@((1,1)@(4,1)) (((0,0)@((10,20)@(((30,40)))))) ((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100)

Output for the Sample Input

3.00000000 3.00000000 3.00000000 1.00000000 1.00000000 4.00000000 0.00000000 2.00000000 -10.00000000 10.00000000 -99.83681795 -91.92248853

Example

Input

((0,0)@(1,1))@((4,1)@(2,5)) ((0,0)@(3,1))@((1,-3)@(2,-1)) (0,0)@(1,1)@(4,1) (0,0)@((1,1)@(4,1)) (((0,0)@((10,20)@(((30,40)))))) ((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100)

Output

3.00000000 3.00000000 3.00000000 1.00000000 1.00000000 4.00000000 0.00000000 2.00000000 -10.00000000 10.00000000 -99.83681795 -91.92248853

样例

((0,0)@(1,1))@((4,1)@(2,5))
((0,0)@(3,1))@((1,-3)@(2,-1))
(0,0)@(1,1)@(4,1)
(0,0)@((1,1)@(4,1))
(((0,0)@((10,20)@(((30,40))))))
((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100)
#
3.00000000 3.00000000

3.00000000 1.00000000 1.00000000 4.00000000 0.00000000 2.00000000 -10.00000000 10.00000000 -99.83681795 -91.92248853

</p>