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:
#define NDEBUG

#include <cassert>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

constexpr double EPS = 1e-8;

struct point {
	double x, y;
	point(double x_, double y_):x(x_), y(y_) {}

	inline point operator+(const point &p) const {
		return point(x + p.x, y + p.y);
	}

	inline point operator-(const point &p) const {
		return point(x - p.x, y - p.y);
	}

	inline point operator*(double s) const {
		return point(x * s, y * s);
	}
};

inline double dot(const point &a, const point &b) {
	return a.x * b.x + a.y * b.y;
}

inline double cross(const point &a, const point &b) {
	return a.x * b.y - a.y * b.x;
}

inline double norm(const point &p) {
	return p.x * p.x + p.y * p.y;
}

struct line {
	point a, b;
	line(const point &a_, const point &b_):a(a_), b(b_) {}
};

inline point project(const line &l, const point &p) {
	const point diff = l.b - l.a;
	return l.a + diff * (dot(p - l.a, diff) / norm(diff));
}

inline point reflect(const line &l, const point &p) {
	return p + (project(l, p) - p) * 2.0;
}

inline point crosspoint(const line &l, const line &m) {
	const double tmp = cross(l.b - l.a, m.b - m.a);
	if(abs(tmp) < EPS) return l.a;
	return m.a + (m.b - m.a) * (cross(l.b - l.a, l.a - m.a) / tmp);
}
 
typedef pair<bool, int> result; // is point, idx
 
vector<point> points;
vector<line> lines;

result parse(string::const_iterator &);
 
int number(string::const_iterator &it) {
	int sign = 1;
	while(*it == '-') {
		sign = -1;
		++it;
	}

	int res = 0;
	while(isdigit(*it)) {
		res = res * 10 + *it - '0';
		++it;
	}
	return sign * res;
}

result factor(string::const_iterator &it) {
	assert(*it == '(');
	++it;
	if(*it == '-' || isdigit(*it)) {
		const double x = number(it);
		assert(*it == ',');
		++it;
		const double y = number(it);
		assert(*it == ')');
		++it;
		points.emplace_back(x, y);
		return make_pair(true, points.size() - 1);
	}
	else {
		const result res = parse(it);
		assert(*it == ')');
		++it;
		return res;
	}
}
 
result parse(string::const_iterator &it) {
	result res = factor(it);

	while(*it == '@') {
		++it;
		result tmp = factor(it);

		switch(res.first + tmp.first) {
		case 2: // point@point
		{
			lines.emplace_back(points[res.second], points[tmp.second]);
			res = make_pair(false, lines.size() - 1);
			break;
		}
		case 1: // line@point
		{
			if(res.first) swap(res, tmp);
			points.emplace_back(reflect(lines[res.second], points[tmp.second]));
			res = make_pair(true, points.size() - 1);
			break;
		}
		case 0: // line@line
		{
			points.emplace_back(crosspoint(lines[res.second], lines[tmp.second]));
			res = make_pair(true, points.size() - 1);
			break;
		}
		default: assert(false);
		}
	}

	return res;
}
 
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(10);

	for(string s; cin >> s && s != "#";) {
		points.clear();
		lines.clear();

		string::const_iterator it = s.cbegin();
 		const result ans = parse(it);
		const point p = points[ans.second];
		cout << p.x << ' ' << p.y << endl;
	}
}