Problem: 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:


<expression>      ::= <point>
<point>       	  ::= <point-factor> | <line> "@" <line-factor> | <line> "@" <point-factor> | <point> "@" <line-factor>
<point-factor>    ::= "(" <number> "," <number> ")" | "(" <point> ")"
<line>            ::= <line-factor> | <point> "@" <point-factor>
<line-factor>     ::= "(" <line> ")"
<number>          ::= <zero-digit> | <positive-number> | <negative-number>
<positive-number> ::= <nonzero-digit> | <positive-number> <digit>
<negative-number> ::= "-" <positive-number>
<digit>           ::= <zero-digit> | <nonzero-digit>
<zero-digit>      ::= "0"
<nonzero-digit>   ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

Each <point> or <point-factor> denotes a point, whereas each <line> or <line-factor> denotes a line. The former notion of <point-factor> $(X,Y)$ represents a point which has $X$ for $x$-coordinate and $Y$ for $y$-coordinate on the $2$-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 $10^2$.
* If both operands of "@" are points, their distance is greater than $1$.
* If both operands of "@" are lines, they are never parallel.
* The absolute values of points' coordinates never exceed $10^2$ at any point of evaluation.



You can also assume that there are at most $100$ datasets.

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

Output

For each dataset, print the $X$ and $Y$ 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 $10^{-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

Solution (in CPP):

Solution:
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


enum Type{
	POINT,
	LINE,
};

struct Point{
	void set(double arg_x,double arg_y){
		x = arg_x;
		y = arg_y;
	}
	double x,y;
};

struct Data{
	Type type;
	Point p1,p2;
};

Point calc_Cross_Point(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	Point ret;
	ret.x = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
	if(x1 != x2){
		ret.y = ((y2-y1)*ret.x+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
	}else{
		ret.y = ((y4-y3)*ret.x+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
	}
	return ret;
}

Point calc_Reflection_Point(double x1,double y1,double x2,double y2,double xp,double yp){

	Point ret;

	bool X_FLG = false,Y_FLG = false;
	double slope;

	if(y1 == y2){
		X_FLG = true;
	}else if(x1 == x2){
		Y_FLG = true;
	}else{
		slope = (y2-y1)/(x2-x1);
	}

	if(X_FLG){
		ret.x = xp,ret.y=y1;
	}else if(Y_FLG){
		ret.x = x1,ret.y = yp;
	}else{
		ret.x = (yp*(x2-x1)*(y2-y1)+xp*(x2-x1)*(x2-x1)-y1*(y2-y1)*(x2-x1)+x1*(y2-y1)*(y2-y1))/((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
		ret.y = ((x1-x2)*ret.x+yp*(y2-y1)+xp*(x2-x1))/(y2-y1);
	}
	ret.x = 2*ret.x-xp;
	ret.y = 2*ret.y-yp;

	return ret;
}

char buf[101];

Data recursive(int left,int right){

	queue<int> Q;

	int depth = 0,max_depth = 0;
	for(int i = left; i <= right; i++){
		if(buf[i] == '('){
			depth++;
			max_depth = max(max_depth,depth);
		}else if(buf[i] == ')'){
			depth--;
		}else if(buf[i] == '@'){
			if(depth == 0)Q.push(i);
		}
	}

	int tmp,index;

	if(Q.empty()){

		if(max_depth >= 2){
			return recursive(left+1,right-1);
		}else{

			Data ret;
			bool negFLG = false;

			tmp = 0;
			for(index = left+1; buf[index] != ','; index++){
				if(buf[index] == '-'){
					negFLG = true;
					continue;
				}

				tmp = 10*tmp+(buf[index]-'0');
			}
			if(negFLG)tmp *= -1;
			ret.p1.x = (double)tmp;

			tmp = 0;
			negFLG = false;
			for(++index; buf[index] != ')'; index++){
				if(buf[index] == '-'){
					negFLG = true;
					continue;
				}
				tmp = 10*tmp+(buf[index]-'0');
			}
			if(negFLG)tmp *= -1;
			ret.p1.y = (double)tmp;
			ret.type = POINT;

			return ret;
		}
	}else{

		Data ret = recursive(left,Q.front()-1);

		Data calc;
		int loc = Q.front();
		Q.pop();
		while(!Q.empty()){
			calc = recursive(loc+1,Q.front()-1);
			if(ret.type == POINT && calc.type == POINT){
				ret.p2 = calc.p1;
				ret.type = LINE;
			}else if(ret.type == LINE && calc.type == LINE){
				ret.p1 = calc_Cross_Point(ret.p1.x,ret.p2.x,calc.p1.x,calc.p2.x,ret.p1.y,ret.p2.y,calc.p1.y,calc.p2.y);
				ret.type = POINT;
			}else{
				if(calc.type == LINE)swap(ret,calc);
				ret.p1 = calc_Reflection_Point(ret.p1.x,ret.p1.y,ret.p2.x,ret.p2.y,calc.p1.x,calc.p1.y);
				ret.type = POINT;
			}
			loc = Q.front();
			Q.pop();
		}
		calc = recursive(loc+1,right);
		if(ret.type == POINT && calc.type == POINT){
			ret.p2 = calc.p1;
			ret.type = LINE;
		}else if(ret.type == LINE && calc.type == LINE){
			ret.p1 = calc_Cross_Point(ret.p1.x,ret.p2.x,calc.p1.x,calc.p2.x,ret.p1.y,ret.p2.y,calc.p1.y,calc.p2.y);
			ret.type = POINT;
		}else{
			if(calc.type == LINE)swap(ret,calc);
			ret.p1 = calc_Reflection_Point(ret.p1.x,ret.p1.y,ret.p2.x,ret.p2.y,calc.p1.x,calc.p1.y);
			ret.type = POINT;
		}
		return ret;
	}
}

void func(){

	int length;

	for(length = 0; buf[length] != '\0'; length++);

	Data ret = recursive(0,length-1);

	printf("%.10lf %.10lf\n",ret.p1.x,ret.p1.y);
}

int main(){

	while(true){
		scanf("%s",buf);
		if(buf[0] == '#')break;

		func();
	}

	return 0;
}