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;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
 
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
 
namespace std {
  bool operator < (const P& a, const P& b){
    return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
}
double dot(P a, P b){ return real(conj(a)*b); }

double cross(P a, P b){ return imag(conj(a)*b); }

P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}

P symmetricPoint(L l,P p){
  P v = l.first - l.second;
  v = v * P(0,-1);
  P c = crossPoint( l, L(p, p + v) );
  v = p - c;
  return c - v;
}

char buf[1111];
int cnt;
int N;

struct state{
  bool kind;
  P a;
  L b;
  state(){kind = true;}
  state(bool kind):kind(kind) {}
};

state xros(state a,state b){
  state ret;
  if( a.kind == true && b.kind == true ){
    ret.kind = false;
    ret.b = L(a.a,b.a);    
  } else if( a.kind == false && b.kind == false ){
    ret.a = crossPoint(a.b,b.b);
  } else {
    if( a.kind == false )
      ret.a = symmetricPoint(a.b,b.a);
    else 
      ret.a = symmetricPoint(b.b,a.a);
  }
  return ret;
}

int number(int &co){
    int k = 1;
    if( buf[co] == '-' ){
      k = -1;
      co++;
    }
    int v1 = 0;
    while( isdigit(buf[co]) ){
      v1 *= 10;
      v1 += (buf[co++]-'0');
    }
    return v1*k;
}

state exp(int l,int r){
  
  int bc = l;
  state p[2];
  int xc=0;
  if( buf[bc] != '(' ){
    int v1 = number(bc);
    assert(buf[bc] == ',' );
    bc++;
    int v2 = number(bc);
    state s;
    s.a = P(v1,v2);
    
    //  cout << "point ( " << l << " , " << r << " ) " << " = " << s.a << endl;
    return s;
  }
  while( buf[bc] == '(' && bc < r ) {
    int cc = 0;
    int st = bc;
    for(int i=bc;i<r;i++){      
      if( buf[i] == '(' ) cc++;
      else if( buf[i] == ')' ) cc--;
      if( cc == 0 ){
	st = i;
	break;
      }
    }
    p[xc&1] = exp(bc+1,st);
    if( xc > 0 ){
      p[xc&1] = xros(p[0],p[1]);
    }
    xc++;
    bc = st+1;
    if( buf[bc] == '@' ) bc++;
  } 
  /* cout << "ques ( " << l << " , " << r << " ) " << " = " ;
   if( p[(xc-1)&1].kind ) cout << p[(xc-1)&1].a << endl;
  else cout << p[(xc-1)&1].b.first << " - " << p[(xc-1)&1].b.second << endl;
  */
  return p[(xc-1)&1];
}

int main(){
  while( cin >> buf ){
    if( buf[0] == '#' ) break;
    cnt = 0;
    N = strlen(buf);
    state res = exp(0,N);
    printf("%.10lf %.10lf\n",res.a.real(),res.a.imag());
  }
}