import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; public class No49 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); String S = br.readLine(); System.out.println(calc(S)); } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } private static int calc(String S) { Queue operatorQueue = new LinkedList(); Queue numQuque = new LinkedList(); String[] numArray = S.split("[\\+*]"); // 数字をキューに格納 for (int i = 0; i < numArray.length; i++) { numQuque.add(Integer.parseInt(numArray[i])); } int sLnegth = S.length(); // 演算子をキューに格納 for (int i = 0; i < sLnegth; i++) { if (!S.substring(i, i + 1).matches("[0-9]")) operatorQueue.add(S.substring(i, i + 1)); } // 計算 int ans = numQuque.poll(); int num = 0; String ope = ""; while (!numQuque.isEmpty()) { num = numQuque.poll(); ope = operatorQueue.poll(); if (ope.equals("+")) { ans = ans * num; } else { ans = ans + num; } } return ans; } }