import scala.util.parsing.combinator._
import scala.io.StdIn

class Arith extends JavaTokenParsers {
  def expr: Parser[Any] = term~rep("+"~term | "-"~term)
  def term: Parser[Any] = factor~rep("*"~factor | "/"~factor)
  def factor: Parser[Any] = floatingPointNumber | "("~expr~")"
}

object Main extends Arith{
  def read(){
    StdIn.readLine() match {
      case line: String => {
        println(parseAll(expr, line.toString))
        read()
      }
      case _ => return
    }
  }
  def main(args: Array[String]){
    read()
  }
}