public class BOJ_1541 { public static void main(String[] args) throws Exception{ // INPUT & INIT BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); StringBuilder sb = new StringBuilder(); int answer = 0; ArrayList<Integer> num = new ArrayList<>(); ArrayList<Integer> op = new ArrayList<>(); for(int i=0; i<str.length(); i++) { char c = str.charAt(i); if(c=='+') { op.add(1); num.add(Integer.parseInt(sb.toString())); sb.setLength(0); }else if(c=='-') { op.add(-1); num.add(Integer.parseInt(sb.toString())); sb.setLength(0); }else { sb.append(c); } } num.add(Integer.parseInt(sb.toString())); // 마지막 숫자 // CALCULATE boolean hasMinus = false; for(int i=0; i<num.size(); i++) { if(i==0) { answer += num.get(i); continue; } if(op.get(i-1) == -1) { answer -= num.get(i); hasMinus = true; }else { if(hasMinus) { answer -= num.get(i); }else { answer += num.get(i); } } } // OUTPUT System.out.println(answer); } }