#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}

#define EPS 1e-10

typedef complex<double> C;

const double PI = 4*atan(1.0);

bool eq(double a,double b)
{
  return (-EPS<a-b&&a-b<EPS);
}

namespace std
{
    bool operator < (const C a, const C b) {
        return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
    }
    bool operator > (const C a, const C b) {
        return a.real() != b.real() ? a.real() > b.real() : a.imag() > b.imag();
    }
    //点をsetとかmapにつめたいとき(誤差を1e-10とか厳しくし過ぎるとバグる)
    // bool operator<(const C a, const C b){
    //     return abs(a.real()-b.real())>EPS ? a.real()<b.real()-EPS : a.imag()<b.imag()-EPS;
    // }
    bool operator==(const C a, const C b){
        return (eq(a.real(),b.real()) && eq(a.imag(),b.imag()));
    }
    bool operator!=(const C a, const C b){
        return !(a == b);
    }
    C operator* (const C a, const C b){
        return C(a.real()*b.real()-a.imag()*b.imag(),a.real()*b.imag()+a.imag()*b.real());
    }
}

struct L : public vector<C>
{
    L(){}
    L(const C a, const C b) {
        push_back(a); push_back(b);
    }
};

double dot(const C a, const C b)
{
    return real(conj(a)*b);
}
C projection(const L& l, const C p)
{
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
C reflection(const L &l, const C p)
{
    return p + (projection(l, p) - p)*2.0;
}
double cross(const C a, const C b)
{
    return imag(conj(a)*b);
}
C crosspointLL(const L& l, const L& m)
{
    double A = cross(l[1] - l[0], m[1] - m[0]);
    double B = cross(l[1] - l[0], l[1] - m[0]);
    //同一直線のとき
    if(abs(A) < EPS && abs(B) < EPS){
        return m[0];
    }
    return m[0] + B / A * (m[1] - m[0]);
}
string s;

pair<L,bool> dfs(int l,int r){
    int dep = 0;
    int ss = -1;
    int cc = 0;
    for(int i=l;i<=r;i++){
        if(s[i]=='('){
            dep++;
        }else if(s[i]==')'){
            dep--;
        }else if(s[i]=='@'){
            cc++;
            if(dep==0){
                ss = i;
            }
        }
    }
    if(ss!=-1){
        auto x = dfs(l,ss-1);
        auto y = dfs(ss+1,r);
        if(x.second!=0)swap(x,y);
        if(x.second==0&&y.second==0){
            return MP(L(x.first[0],y.first[0]),1);
        }else if(x.second==0&&y.second==1){
            C xx =  reflection(y.first,x.first[0]);
            return MP(L(xx,C(0,0)),0);
        }else if(x.second==1&&y.second==1){
            C xx = crosspointLL(x.first,y.first);
            return MP(L(xx,C(0,0)),0);
        }
    }else{
        if(cc!=0&&s[l]=='('){
            return dfs(l+1,r-1);
        }else{
            double a=0,b=0;
            double aa=1,bb=1;
            bool flag = 1;
            for(int i=l;i<=r;i++){
                if(flag&&s[i]=='-'){
                    aa = -1.0;
                }else if(flag&&s[i]>='0'&&s[i]<='9'){
                    a *= 10;
                    a += s[i]-'0';
                }else if(flag&&s[i]==','){
                    flag = 0;
                }else if(s[i]=='-'){
                    bb = -1.0;
                }else if(s[i]>='0'&&s[i]<='9'){
                    b *= 10;
                    b += s[i]-'0';
                }
            }
            return MP(L(C(a*aa,b*bb),C(0,0)),0);
        }
    }
}

int main(){
    cout.precision(20);
    while(1){
        cin >> s;
        if(s=="#")break;
        int n = s.size();
        auto x = dfs(0,n-1);
        C xx = x.first[0];
        cout << xx.real() << " " << xx.imag() << "\n";
    }
    return 0;
}
