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 <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <set>
#include <map>
#include <assert.h>

using namespace std;

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

typedef long long ll;

string parse_target;
string::const_iterator iter, last;

bool consume(char expected) { if(*iter == expected) { iter++; return true; } else { assert(false); } }
bool consume_if(char expected) { if(*iter == expected) { consume(expected); return true; } return false; }
void debugger() { for(auto tmp = iter;tmp!=last;tmp++) cout << *tmp; cout << endl; }

double number() {
  string str;
  for(; isdigit(*iter) || *iter=='-'; iter++) {
    str += *iter;
  }
  return stod(str);
}

typedef complex<double> Point;
typedef vector<Point> Line;
enum { undefined_style, line_style, point_style };
struct result_type
{
  int style_;
  Line line_; Point point_;
  result_type(Point const& a, Point const& b): style_(line_style), point_() { line_.push_back(a), line_.push_back(b); }
  result_type(Point p): style_(point_style), line_(), point_(p) {}
  result_type(double x, double y): style_(point_style), line_(), point_(x, y) {}
  result_type(): style_(undefined_style), line_(), point_() {}
};

double dot(Point const& a, Point const& b) { return real(conj(a)*b); }
double cross(Point const& a, Point const& b) { return imag(conj(a)*b); }

Point intersection(Line const& a, Line const& b) {
  Point va = a[1]-a[0], vb = b[1]-b[0];
  return a[0] + va * cross(vb, b[0]-a[0]) / cross(vb, va);
}

Point projection_point(Line const& l, Point const& p) {
  double k = dot(l[1]-l[0], p-l[0]) / norm(l[1]-l[0]);
  return l[0]+k*(l[1]-l[0]);
}
 
Point reflection_point(Line const& l, Point const& p) {
  return p + 2.*(projection_point(l, p) - p);
}

result_type make_symmetric_point(result_type line, result_type p) {
  if(line.style_ == point_style) swap(line, p);
  return result_type(reflection_point(line.line_, p.point_));
}

result_type rec();

result_type term() {
  result_type ret;
  if((*iter == '(') && (isdigit(*(iter+1)) || *(iter+1)=='-')) {
    consume('(');
    auto lhs = number();
    consume(',');
    auto rhs = number();
    consume(')');
    return {lhs, rhs};
  }
  else if(consume_if('(')) {
    auto expr = rec();
    consume(')');
    return expr;
  }
  else {
    if(ret.style_ == undefined_style) ret = rec();
    consume(')');
    return ret;
  }
}

result_type rec() {

  result_type ret = term();

  for(;iter<last;) {
    if(consume_if('@')) {
      auto rhs = term();
      if(ret.style_ == point_style      && rhs.style_ == point_style) ret = {ret.point_, rhs.point_};
      else if(ret.style_ == line_style  && rhs.style_ == line_style)  ret = intersection(ret.line_, rhs.line_);
      else ret = make_symmetric_point(ret, rhs);
    }
    else {
      break;
    }
  }
  return ret;
}

int main() {

  for(;getline(cin, parse_target);) {
    if(parse_target == "#") { break; }
    iter = parse_target.begin(), last = parse_target.end();
    auto res = rec();
    printf("%.8f %.8f\n", res.point_.real(), res.point_.imag());
  }

  return 0;
}