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:
/*
 * 2596.cc: Points and Lines
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

template <typename T>
struct Pt {
  T x, y;

  Pt() {}
  Pt(T _x, T _y) : x(_x), y(_y) {}
  Pt(const Pt& pt) : x(pt.x), y(pt.y) {}

  bool operator==(const Pt pt) const { return x == pt.x && y == pt.y; }
  Pt<T> operator+(const Pt pt) const { return Pt<T>(x + pt.x, y + pt.y); }
  Pt<T> operator-() const { return Pt<T>(-x, -y); }
  Pt<T> operator-(const Pt pt) const { return Pt<T>(x - pt.x, y - pt.y); }
  Pt<T> operator*(T t) const { return Pt<T>(x * t, y * t); }
  Pt<T> operator/(T t) const { return Pt<T>(x / t, y / t); }
  T dot(Pt v) const { return x * v.x + y * v.y; }
  T cross(Pt v) const { return x * v.y - y * v.x; }
  Pt<T> mid(const Pt pt) { return Pt<T>((x + pt.x) / 2, (y + pt.y) / 2); }
  T d2() { return x * x + y * y; }
  double d() { return sqrt(d2()); }

  Pt<T> rot(double th) {
    double c = cos(th), s = sin(th);
    return Pt<T>(c * x - s * y, s * x + c * y);
  }

  Pt<T> rot90() { return Pt<T>(-y, x); }

  bool operator<(const Pt& pt) const {
    return x < pt.x || (x == pt.x && y < pt.y);
  }

  void print(string format) {
    printf(("(" + format + ", " + format + ")\n").c_str(), x, y);
  }
  void print() { print("%.6lf"); }
};

typedef Pt<double> pt;

enum { TP = 0, TL = 1 };

struct pl {
  int t;
  pt p, v;
};

struct CL {
  pt p;
  double t0, t1;
  CL() {}
  CL(const pt& _p, double _t0, double _t1) : p(_p), t0(_t0), t1(_t1) {}
};

/* global variables */

/* subroutines */

bool cross_lines(const pt& ap, const pt av, const pt& bp, const pt bv, CL& cl) {
  double op01 = av.cross(bv);
  //if (op01 == 0.0) return false; /* need to handle parallel?? */

  if (op01 == 0.0) {
    pt v = bp - ap;
    if (v.cross(av) != 0.0) return false;

    pt a1 = ap + av;
    pt b1 = bp + bv;

    return
      ((bp - ap).dot(b1 - ap) <= 0.0 ||
       (bp - a1).dot(b1 - a1) <= 0.0 ||
       (ap - bp).dot(a1 - bp) <= 0.0 ||
       (ap - b1).dot(a1 - b1) <= 0.0);
  }

  pt v = bp - ap;
  double op0 = v.cross(av);
  double op1 = v.cross(bv);

  double t0 = op1 / op01;
  double t1 = op0 / op01;

  cl.p = bv * t1 + bp;
  cl.t0 = t0;
  cl.t1 = t1;

  return true;
  //return (0.0 <= cl.t0 && cl.t0 <= 1.0 && 0.0 <= cl.t1 && cl.t1 <= 1.0);
}

pl expr(string &s, int &pos);

int num(string &s, int &pos) {
  int sign = 1, num = 0;
  if (s[pos] == '-') sign = -1, pos++;
  while (pos < s.size() && s[pos] >= '0' && s[pos] <= '9')
    num = num * 10 + s[pos++] - '0';
  return num * sign;
}

pl term(string &s, int &pos) {
  pos++; // '('
  pl e;
  if (s[pos] == '(') {
    e = expr(s, pos);
  }
  else {
    int x = num(s, pos);
    pos++; // ','
    int y = num(s, pos);
    e.t = TP;
    e.p = pt(x, y);
  }
  pos++; // ')'
  return e;
}

pl expr(string &s, int &pos) {
  pl t0 = term(s, pos);

  while (pos < s.size() && s[pos] == '@') {
    pos++; // '@'
    pl t1 = term(s, pos);

    CL cl;
    if (t0.t == TP && t1.t == TP) {
      t0.t = TL;
      t0.v = t1.p - t0.p;
    }
    else if (t0.t == TL && t1.t == TL) {
      cross_lines(t0.p, t0.v, t1.p, t1.v, cl);
      t0.t = TP;
      t0.p = cl.p;
    }
    else if (t0.t == TP && t1.t == TL) {
      cross_lines(t0.p, t1.v.rot90(), t1.p, t1.v, cl);
      t0.t = TP;
      t0.p = (cl.p - t0.p) * 2.0 + t0.p;
    }
    else {
      cross_lines(t1.p, t0.v.rot90(), t0.p, t0.v, cl);
      t0.t = TP;
      t0.p = (cl.p - t1.p) * 2.0 + t1.p;
    }
  }

  return t0;
}

/* main */

int main() {
  for (;;) {
    string s;
    cin >> s;
    if (s == "#") break;

    int pos = 0;
    pl e = expr(s, pos);
    printf("%.8lf %.8lf\n", e.p.x, e.p.y);
  }

  return 0;
}