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 <bits/stdc++.h>
using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

class Point{
public:
  double x, y;

  Point(double x = 0.0, double y = 0.0) : x(x), y(y){}

  Point operator + (const Point& p) const{ return Point(x + p.x, y + p.y); }
  Point& operator += (const Point& p){ x += p.x; y += p.y; return *this;}
  Point operator - (const Point& p) const{ return Point(x - p.x, y - p.y); }
  Point& operator -= (const Point& p){ x -= p.x; y -= p.y; return *this;}
  Point operator * (double a) const{ return Point(a*x, a*y); }
  Point& operator *= (double a){ x *= a; y *= a; return *this;}
  Point operator / (double a) const{ return Point(x / a, y / a); }
  Point& operator /= (double a){ x /= a; y /= a; return *this;}

  double abs(){ return sqrt(norm()); }
  double norm(){ return x*x + y*y; }
  
  bool operator < (const Point &p) const{
	return x != p.x ? x < p.x : y < p.y;
  }
  
  bool operator == (const Point &p) const {
	return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
  friend ostream& operator <<(ostream& os, const Point& p);
};
ostream& operator <<(ostream& os, const Point& p){
  return os << "(" << p.x << ","<<p.y << ")";
}

class Segment{
public:
  Point p1, p2;
  Segment(){}
  Segment(const Point& p1_, const Point& p2_)
	: p1(p1_), p2(p2_)
  {}
};
typedef vector<Point> Polygon;
typedef Point Vector;
typedef Segment Line;
double dot(Vector a, Vector b){
	return a.x*b.x + a.y*b.y;
}
double cross(Vector a, Vector b){
	return a.x*b.y - a.y*b.x;
}
Point project(Line s, Point p){
	Vector base = s.p2 - s.p1;
	double r = dot(p - s.p1, base) / base.norm();
	return s.p1 + base*r;
}
Point reflect(Segment s, Point p){
	return p + (project(s, p) - p) * 2.0;
}
Point getCrossPoint(Segment s1, Segment s2){
  Vector a = s1.p2 - s1.p1;
  Vector b = s2.p2 - s2.p1;
  double t = cross(b, s2.p1-s1.p1) / cross(b, a);
  Vector v = a*t;
  return s1.p1 + v;
}

struct P{
  int type;
  Point p1;
  Point p2;
  P(): type(-1){}
};
int pos(int l, string& s, P& p){
  int i, m = l+1;
  p.type = 0;
  for(i=l+1;;++i){
	if(s[i] == ','){
	  p.p1.x = stoi(s.substr(m,i-m));
	  m = i+1;
	}
	else if(s[i] == '}'){
	  p.p1.y = stoi(s.substr(m,i-m));
	  break;
	}
  }
  return i;
}
P op(P p1, P p2){
  if(p1.type < 0) return p2;
  P res;
  if(p1.type == 0){
	if(p2.type == 0){
	  res.type = 1;
	  res.p1 = p1.p1;
	  res.p2 = p2.p1;
	}
	else{
	  res.type = 0;
	  res.p1 = reflect(Segment(p2.p1, p2.p2), p1.p1);
	}
  }
  else{
	if(p2.type == 0){
	  res.type = 0;
	  res.p1 = reflect(Segment(p1.p1, p1.p2), p2.p1);
	}
	else{
	  res.type = 0;
	  res.p1 = getCrossPoint(Segment(p1.p1,p1.p2), Segment(p2.p1,p2.p2));
	}
  }
  return res;
}
int find(int l, string& s){
  int lv = 0;
  for(int i=l;;++i){
	if(s[i] == '(') ++lv;
	else if(s[i] == ')'){
	  --lv;
	  if(lv == 0){
		return i;
	  }
	}
  }
  return -1;
}

P parse(int l, int r, string& s){
  P res;
  for(int i=l;i<r;++i){
	if(s[i] == '('){
	  int rr = find(i, s);
	  res = parse(i+1, rr, s);
	  i = rr;
	}
	else if(s[i] == '@'){
	  ++i;
	  if(s[i] == '('){
		int rr = find(i, s);
		res = op(res, parse(i+1, rr, s));
		i = rr;
	  }
	  else if(s[i] == '{'){
		P tmp;
		i = pos(i, s, tmp);
		res = op(res, tmp);
	  }
	  else exit(1);
	}
	else if(s[i] == '{'){
	  P tmp;
	  i = pos(i, s, tmp);
	  res = op(res, tmp);
	}
	else exit(1);
  }
  return res;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  string s;
  while(getline(cin,s)){
	if(s == "#") break;
	REP(i,SZ(s)){
	  if(s[i] == '(' && (s[i+1] == '-' || isdigit(s[i+1])))
		s[i] = '{';
	  else if(s[i] == ')' && (s[i-1] == '-' || isdigit(s[i-1])))
		s[i] = '}';
	}
	P ans = parse(0, SZ(s), s);
	cout << fixed << setprecision(9) << ans.p1.x << " " << ans.p1.y << endl;
  }

  return 0;
}