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 ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

/* 基本要素 */
typedef complex<double> Point;
typedef pair<Point, Point> Line;
typedef vector<Point> VP;
const double EPS = 1e-9; // 許容誤差^2
const double INF = 1e9;
#define X real()
#define Y imag()
// #define LE(n,m) ((n) < (m) + EPS)
#define LE(n,m) ((n) - (m) < EPS)
// #define GE(n,m) ((n) + EPS > (m))
#define GE(n,m) (EPS > (m) - (n))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
double dot(Point a, Point b) {
  return a.X*b.X + a.Y*b.Y;
}

// 外積　cross(a,b) = |a||b|sinθ
double cross(Point a, Point b) {
  return a.X*b.Y - a.Y*b.X;
}

// 点の進行方向
int ccw(Point a, Point b, Point c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}


// 点pの直線aへの射影点を返す
Point proj(Point a1, Point a2, Point p) {
  return a1 + dot(a2-a1, p-a1)/norm(a2-a1) * (a2-a1);
}

// 点pの直線aへの反射点を返す
Point reflection(Point a1, Point a2, Point p) {
  return 2.0*proj(a1, a2, p) - p;
}

// 2直線の交点
Point crosspointLL(Point a1, Point a2, Point b1, Point b2) {
  double d1 = cross(b2-b1, b1-a1);
  double d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  assert(!EQ(d2, 0)); // 交点がない
  return a1 + d1/d2 * (a2-a1);
}

string s;
int n;

// 0:Point, 1:Line
using V = pair<Line, int>;
Point NUL(-1,-1);

Point calc(int l, int r){
    while(s[l]=='(') ++l;
    while(s[r]==')') --r;

    int idx = l;
    while(idx<r && s[idx]!=',') ++idx;

    int x = atoi(s.substr(l,idx-l).c_str());
    int y = atoi(s.substr(idx+1,r-idx).c_str());

    return Point(x,y);
}

V AT(V l, V r){
    if(l.se > r.se) swap(l,r);

    if(l.se == 0 && r.se == 0){
        return {{l.fi.fi, r.fi.fi},1};
    }
    else if(l.se == 0 && r.se == 1){
        Point p = reflection(r.fi.fi, r.fi.se, l.fi.fi);
        return {{p, NUL}, 0};
    }
    else if(l.se == 1 && r.se == 1){
        Point p = crosspointLL(l.fi.fi, l.fi.se, r.fi.fi, r.fi.se);
        return {{p, NUL}, 0};
    }
    else assert(false);
}

// [l,r]
V f(int l, int r){
    int opct = 0;
    int d = 0;
    int pos = -1;
    for(int i=l; i<=r; ++i){
        if(s[i]=='@'){
            ++opct;
            if(d==0) pos = i;
        }
        else if(s[i]=='(') ++d;
        else if(s[i]==')') --d;
    }

    V ret;
    if(opct == 0){
        Point p = calc(l,r);
        ret = {{p,NUL},0};
    }
    else{
        if(pos != -1){
            V lh = f(l,pos-1), rh = f(pos+1,r);
            ret = AT(lh,rh);
        }
        else{
            assert(s[l]=='(' && s[r]==')');
            ret = f(l+1,r-1);
        }
    }
    return ret;
}

int main(){
    while(cin >>s,(s!="#")){
        n = s.size();
        Point ans = f(0,n-1).fi.fi;
        printf("%.10f %.10f\n", ans.X, ans.Y);
    }
    return 0;
}