#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) {cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl;}

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}
bool operator<(const TRI&_)const{return(fi==_.fi)?((se==_.se)?(th<_.th):(se<_.se)):(fi<_.fi);}};
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,TRI<S,T,U>&t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

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 (eq(a.real(),b.real()) && eq(a.imag(),b.imag()));
    }
    bool operator!=(const C a, const C b){
        return !(a == b);
    }
}

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

double cross(const C a, const C b)
{
    return imag(conj(a)*b);
}

double dot(const C a, const C b)
{
    return real(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]);
}

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]);
}

string s;
int pos;

L expr();

bool ispoint(const L& l){
    return (l[1].real() <= -INF);
}

L opr(L l, L m){
    if(ispoint(l) && ispoint(m)){
        return {l[0], m[0]};
    }else if(ispoint(l)){
        C res = projection(m, l[0]);
        res = {2 * res.real(), 2 * res.imag()};
        return {res - l[0], {-2 * INF, -2 * INF}};
    }else if(ispoint(m)){
        C res = projection(l, m[0]);
        res = {2 * res.real(), 2 * res.imag()};
        return {res - m[0], {-2 * INF, -2 * INF}};
    }else{
        return {crosspointLL(l, m), {-2 * INF, -2 * INF}};
    }
}

L point_factor(){
    ++pos;
    bool minus = false;
    if(s[pos] == '-') minus = true, ++pos;
    double bue = 0, bar = 0;
    while(isdigit(s[pos])){
        bue *= 10.0;
        bue += (int)(s[pos++] - '0');
    }
    if(minus) bue = -bue;
    ++pos;
    minus = false;
    if(s[pos] == '-') minus = true, ++pos;
    while(isdigit(s[pos])){
        bar *= 10.0;
        bar += (int)(s[pos++] - '0');
    }
    if(minus) bar = -bar;
    ++pos;
    return {{bue, bar}, {-2 * INF, - 2 * INF}};
}

L point(){
    if(isdigit(s[pos+1]) || s[pos+1] == '-') return point_factor();
    ++pos;
    L res = expr();
    ++pos;
    return res;
}

L expr(){
    L res = point();
    while(s[pos] == '@'){
        pos++;
        res = opr(res, point());
    }
    return res;
}

int main()
{
    while(true){
        cin >> s;
        if(s == "#") break;
        pos = 0;
        L res = expr();
        printf("%.12lf %.12lf\n", res[0].real(), res[0].imag());
    }
    return 0;
}


Measured memory_bytes: 3236