import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; public class No193 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); int max = Integer.MIN_VALUE; String S = br.readLine(); int Slength = S.length(); String head = ""; String tail = ""; for (int i = 0; i < Slength; i++) { head = S.substring(0, 1); tail = S.substring(Slength - 1, Slength); // 先頭としっぽが記号だったらcontinue if (head.equals("+") || head.equals("-") || tail.equals("+") || tail.equals("-")) { S = rotateString(S, 1); continue; } max = Math.max(calc(S), max); // 円筒のきる部分を変える S = rotateString(S, 1); } System.out.println(max); } 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; } static String rotateString(String S, int n) { StringBuilder sb = new StringBuilder(S); String head = sb.substring(0, n); sb.delete(0, n); sb.append(head); return sb.toString(); } }