import scala.annotation.tailrec

object Main extends App {
  import scala.io.StdIn._

  solve
  def solve: Unit = {
    val expression = readLine.trim
    if (expression == "#") return
    expression.toList match {
      case (p: Point) Expression Nil ⇒ println(s"${p.x} ${p.y}")
      case _ ⇒ ???
    }
    solve
  }

  object Expression {
    def unapply(arg: List[Char]): Option[(Result, List[Char])] = {
      arg match {
        case f Factor rest ⇒
          Some(takeAll(rest, f))
        case _ ⇒ None
      }
    }
    @tailrec
    def takeAll(arg: List[Char], prev: Result): (Result, List[Char]) = {
      arg match {
        case '@'::(f Factor r) ⇒
          takeAll(r, op(prev, f))
        case _ ⇒
          (prev, arg)
      }
    }
    private[this] def op(a: Result, b: Result): Result = {
      (a, b) match {
        case (p1: Point, p2: Point) ⇒
          Line(p1, p2)
        case (p: Point, l: Line) ⇒
          p.flipBy(l)
        case (l: Line, p: Point) ⇒
          p.flipBy(l)
        case (l1: Line, l2: Line) ⇒
          l1.crossPoint(l2)
        case _ ⇒ ???
      }
    }
  }
  object Factor {
    def unapply(arg: List[Char]): Option[(Result, List[Char])] = {
      arg match {
        case p PointFactor r ⇒
          Some(p, r)
        case '('::(e Expression ')'::r) ⇒
          Some(e, r)
        case _ ⇒ None
      }
    }
  }
  object PointFactor {
    def unapply(arg: List[Char]): Option[(Point, List[Char])] = {
      arg match {
        case '('::(x Number ','::(y Number ')'::r)) ⇒ Some(Point(x, y), r)
        case _ ⇒ None
      }
    }
  }
  object Number {
    def unapply(arg: List[Char]): Option[(Double, List[Char])] = {
      arg match {
        case '-'::rest ⇒
          rest.span(_.isDigit) match {
            case (Nil, _) ⇒ None
            case (n, r) ⇒ Some(n.foldLeft(0){(a, b) ⇒ a * 10 - b.asDigit}, r)
          }
        case _ ⇒
          arg.span(_.isDigit) match {
            case (Nil, _) ⇒ None
            case (n, r) ⇒ Some(n.foldLeft(0){(a, b) ⇒ a * 10 + b.asDigit}, r)
          }
      }
    }
  }
  sealed trait Result
  case class Point(x: Double, y: Double) extends Result {
    def -(that: Point): Point = Point(x - that.x, y - that.y)
    def +(that: Point): Point = Point(x + that.x, y + that.y)
    def flipBy(line: Line): Point = {
      Line(this, Angle(line).rotate90Clockwise).crossPoint(line).let(p ⇒ p - this + p)
    }
  }
  object Line {
    def apply(point: Point, angle: Angle): Line = {
      //cos(y - p.y) == sin(x - p.x)
      Line(-angle.sin, angle.cos, angle.sin * point.x - angle.cos * point.y)
    }
    def apply(a: Point, b: Point): Line = {
      //(a.x - b.x)(y - b.y) == (a.y - b.y)(x - b.x)
      Line(b.y - a.y, a.x - b.x, a.y * b.x - a.x * b.y)
    }
  }
  case class Line(a: Double, b: Double, c: Double) extends Result {
    def crossPoint(that: Line): Point = {
      Point((this.b * that.c - that.b * this.c) / (this.a * that.b - that.a * this.b), (that.a * this.c - this.a * that.c) / (this.a * that.b - that.a * this.b))
    }

  }
  object Angle {
    def apply(line: Line): Angle = {
      val norm = math.sqrt(line.a * line.a + line.b * line.b)
      new Angle(-line.a / norm, line.b / norm)
    }
  }
  class Angle(val sin: Double, val cos: Double) {
    def + (that: Angle): Angle = new Angle(sin * that.cos + cos * that.sin, cos * that.cos - sin * that.sin)
    def - (that: Angle): Angle = new Angle(sin * that.cos - cos * that.sin, cos * that.cos + sin * that.sin)
    def rotate90Clockwise: Angle = new Angle(-cos, sin)
  }
  implicit class Scope[T](val value: T) extends AnyVal{
    @inline
    def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}


Measured memory_bytes: 46060