import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final String S = sc.next(); int max = Integer.MIN_VALUE; for(int slide = 0; slide < S.length(); slide++){ final String rotated = S.substring(slide) + S.substring(0, slide); if(rotated.charAt(0) == '+' || rotated.charAt(0) == '-'){ continue; }else if(rotated.charAt(rotated.length() - 1) == '+' || rotated.charAt(rotated.length() - 1) == '-'){ continue; } char[] in = rotated.toCharArray(); int current = 0, cur_pos = 0; while(cur_pos < in.length && '0' <= in[cur_pos] && in[cur_pos] <= '9'){ current *= 10; current += Character.getNumericValue(in[cur_pos++]); } while(cur_pos < in.length){ final int sign = in[cur_pos] == '+' ? 1 : -1; cur_pos++; int snd = 0; while(cur_pos < in.length && '0' <= in[cur_pos] && in[cur_pos] <= '9'){ snd *= 10; snd += Character.getNumericValue(in[cur_pos++]); } current += sign * snd; } max = Math.max(max, current); } System.out.println(max); } }