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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>
#include <regex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

typedef double P_type;
typedef complex<P_type> P;

//??????
double dot(P a, P b) {
  return (a * conj(b)).real();
}

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

P getCrosspointLL(P a1, P a2, P b1, P b2) {
  P a = a2 - a1;
  P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}

P getProject(P a1, P a2, P p){
  P base = a2 - a1;
  double r = dot(p - a1, base) / (abs(base) * abs(base));
  return a1 + base * r;
}

P getReflection(P a1, P a2, P p){
  return p + (getProject(a1, a2, p) - p) * 2.0;
}

struct Line{
  double a,b,c,d;

  Line(double a, double b, double c, double d):a(a),b(b),c(c),d(d){}
  Line(){}
};

void solve(string s){
  vector<Line> lines;
  string prevs = "";
  
  while(prevs != s){
    prevs = s;
    s = regex_replace(s, regex("\\(\\(([^()]+)\\)\\)"),"($1)");

    if(s != prevs) continue;
    
    //debug(s);

    match_results<string::const_iterator> mr1, mr2, mr3, mr4;
    int minpos = INF;
    auto r1 = regex("\\(([0-9.-]+),([0-9.-]+)\\)@\\(([0-9.-]+),([0-9.-]+)\\)");
    auto r2 = regex("\\(L(\\d+)\\)@\\(L(\\d+)\\)");
    auto r3 = regex("\\(([0-9.-]+),([0-9.-]+)\\)@\\(L(\\d+)\\)");
    auto r4 = regex("\\(L(\\d+)\\)@\\(([0-9.-]+),([0-9.-]+)\\)");
    bool f1 = regex_search(s, mr1, r1);
    bool f2 = regex_search(s, mr2, r2);
    bool f3 = regex_search(s, mr3, r3);
    bool f4 = regex_search(s, mr4, r4);

    if(f1) minpos = min(minpos, (int)mr1.position(0));
    if(f2) minpos = min(minpos, (int)mr2.position(0));
    if(f3) minpos = min(minpos, (int)mr3.position(0));
    if(f4) minpos = min(minpos, (int)mr4.position(0));
    
    if(f1 && minpos == mr1.position(0)){
      double a = stod(mr1[1]);
      double b = stod(mr1[2]);
      double c = stod(mr1[3]);
      double d = stod(mr1[4]);

      lines.push_back(Line(a,b,c,d));

      s = regex_replace(s, r1,"(L"+to_string(lines.size()-1)+")", regex_constants::format_first_only);
      continue;
    }

    if(f2 && minpos == mr2.position(0)){
      int p = stoi(mr2[1]);
      int q = stoi(mr2[2]);

      auto c = getCrosspointLL(P(lines[p].a, lines[p].b),P(lines[p].c, lines[p].d),
                               P(lines[q].a, lines[q].b),P(lines[q].c, lines[q].d));

      s = regex_replace(s, r2,"("+to_string(c.real())+","+to_string(c.imag())+")",regex_constants::format_first_only);
      continue;
    }

    if(f3 && minpos == mr3.position(0)){
      double a = stod(mr3[1]);
      double b = stod(mr3[2]);
      int p = stoi(mr3[3]);

      auto c = getReflection(P(lines[p].a, lines[p].b),P(lines[p].c, lines[p].d),P(a,b));

      s = regex_replace(s, r3, "("+to_string(c.real())+","+to_string(c.imag())+")",regex_constants::format_first_only);
      continue;
    }

    if(f4 && minpos == mr4.position(0)){
      double a = stod(mr4[2]);
      double b = stod(mr4[3]);
      int p = stoi(mr4[1]);

      auto c = getReflection(P(lines[p].a, lines[p].b),P(lines[p].c, lines[p].d),P(a,b));

      s = regex_replace(s, r4, "("+to_string(c.real())+","+to_string(c.imag())+")",regex_constants::format_first_only);
      continue;
    }
  }

  cout << regex_replace(s, regex("\\((.+),(.+)\\)"),"$1 $2") << endl;
}

int main(){
  string s;
  
  while(1){
    cin >> s;
    if(s[0] == '#') break;
    solve(s);
  }
  
  return 0;
}