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 <cctype>
#include <cassert>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>

using Point = std::complex<double>;
using Line = std::vector<Point>;

Point get_ipoint(const Line &l1, const Line &l2) {
  double x1=l1[0].real(), x2=l1[1].real();
  double x3=l2[0].real(), x4=l2[1].real();
  double y1=l1[0].imag(), y2=l1[1].imag();
  double y3=l2[0].imag(), y4=l2[1].imag();

  double x=(y4-y3)*(x4-x1)-(x4-x3)*(y4-y1);
  double d=(y4-y3)*(x2-x1)-(x4-x3)*(y2-y1);

  return Point(x1, y1) + (x/d)*Point(x2-x1, y2-y1);
}

double dot_prod(const Point &p1, const Point &p2) {
  return (conj(p1)*p2).real();
}

class PointOrLine {
  bool is_line() const {
    return points.size() == 2;
  }

public:
  std::vector<Point> points;

  PointOrLine(double x, double y): points{Point(x, y)} {}
  PointOrLine(Point z): points{z} {}
  PointOrLine(Point z, Point w): points{z, w} {}

  PointOrLine operator |(const PointOrLine &oth) const {
    if (is_line() && oth.is_line()) {
      return get_ipoint(points, oth.points);
    } else if (is_line()) {
      Point p1=points[0], p2=points[1];
      Point p=oth.points[0];
      Point e(p2.real()-p1.real(), p2.imag()-p1.imag());
      e /= abs(e);

      double r=dot_prod(p-p1, e);
      Point h=p1+r*e;
      return p+2.0*(h-p);
    } else if (oth.is_line()) {
      return oth | *this;
    } else {
      return PointOrLine(points[0], oth.points[0]);
    }
  }

  Point point() const {
    assert(!is_line());
    return points[0];
  }
};

PointOrLine parse(const std::string &s, size_t &i, size_t preced=0) {
  if (preced == 1) {
    if (s[i] == '(') {
      PointOrLine res=parse(s, ++i, 0);
      assert(s[i] == ')');
      ++i;
      return res;
    }
    if (isdigit(s[i]) || s[i] == '-') {
      bool xneg=false, yneg=false;
      if (s[i] == '-') {
        xneg = true;
        ++i;
      }
      double x=s[i]-'0';
      while (s[++i] != ',') x = x*10+s[i]-'0';
      if (xneg) x = -x;

      ++i;
      if (s[i] == '-') {
        yneg = true;
        ++i;
      }

      double y=s[i]-'0';
      while (s[++i] != ')') y = y*10+s[i]-'0';
      if (yneg) y = -y;

      return PointOrLine(x, y);
    }
    assert(false);
  }

  PointOrLine res=parse(s, i, 1);
  while (i < s.length()) {
    char op=s[i];
    if (op != '@') break;
    PointOrLine tmp=parse(s, ++i, 1);
    res = res|tmp;
  }
  return res;
}

int testcase_ends() {
  char buf[128];
  scanf("%s", buf);
  std::string s=buf;
  if (s == "#") return 1;
  size_t i=0;
  Point point=parse(s, i).point();
  printf("%.12f %.12f\n", point.real(), point.imag());
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}