用split先按+-号断开,再各按*/号断开

import java.util.*;
public class Main{
    public static int f(String str){
        String[] v = str.split("[*/]");//先算乘除法
        int r = Integer.valueOf(v[0]);
        int k = v[0].length();//运算符的下标
        for(int i = 1; i < v.length; ++i){
            if(str.charAt(k) == '*') r *= Integer.valueOf(v[i]);
            if(str.charAt(k) == '/') r /= Integer.valueOf(v[i]);
            k += v[i].length() + 1;
        }
        return r;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            String str = sc.nextLine();
            if(str.equals("END")) break;
            String[] v = str.split("[+-]");//再算加减法
            int r = f(v[0]);
            int k = v[0].length();//运算符的下标
            for(int i = 1; i < v.length; ++i){
                if(str.charAt(k) == '+') r += f(v[i]);
                if(str.charAt(k) == '-') r -= f(v[i]);
                k += v[i].length() + 1;
            }
            System.out.println(r);
        }
    }
}