import java.io.*; import java.util.*; class Main { public static void out (Object o) { System.out.println(o); } public static int calc (String s) { //out("calc:" + s); int ret = 0 , work = 0 , i = 0 , len = s.length(); boolean addFlg = true; while (i < len) { while (i < len && s.charAt(i) != '+' && s.charAt(i) != '-') work = work * 10 + (s.charAt(i++) - '0'); ret = addFlg ? ret + work : ret - work; //out("ret : " + ret + "\ti : " + i); work = 0; if (i < len) addFlg = s.charAt(i++) == '+'; } return ret; } public static int solve (String s) { int ret = Integer.MIN_VALUE; int len = s.length(); for (int i = 0; i < len; i++) { String t = ""; for (int j = 0; j < len; j++) { t += s.charAt((i + j) % len) + ""; } if (!(t.charAt(0) + "").matches("[0-9]") || !(t.charAt(len - 1) + "").matches("[0-9]")) { continue; } ret = Math.max(ret , calc(t)); } return ret; } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); out(solve(br.readLine())); } }