import math._ object Main { def calc(s: String): Int = { val reg = "(\\d+|[+*])".r val tokens = reg.findAllIn(s).toList var ans = tokens(0).toInt for (i <- 1 to tokens.length-1 by 2) { val rhs = tokens(i+1).toInt tokens(i) match { case "+" => ans *= rhs case "*" => ans += rhs case _ => assert(false) } } ans } def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val s = sc.next println(calc(s)) } }