import java.util.Scanner; public class Main_yukicoder193 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int n = s.length(); s = s + s; int max = Integer.MIN_VALUE; for (int i = 0; i < n; i++) { max = Math.max(max, calc(s.substring(i, i + n))); } System.out.println(max); sc.close(); } private static int calc(String str) { int n = str.length(); if (str.charAt(0) == '+' || str.charAt(0) == '-') { return Integer.MIN_VALUE; } if (str.charAt(n - 1) == '+' || str.charAt(n - 1) == '-') { return Integer.MIN_VALUE; } int i; int j = 0; int ret = 0; for (i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == '+' || c == '-') { int tmp = Integer.parseInt(str.substring(j, i)); ret += tmp; j = i; } } int tmp = Integer.parseInt(str.substring(j, i)); ret += tmp; return ret; } }