#include #include #include #define rep(i, n) for (i = 0; i < n; i++) #define rrep(i, n) for (i = n; i >= 0; i--) #define max(a, b) (a > b ? a : b) #define inf 1145141919 #define minus 0 #define plus 1 bool is_operator(char c) { if (c == '+' || c == '-') return true; else return false; } bool is_calcable(char *s, int l) { if (is_operator(s[0]) || is_operator(s[l - 1])) return false; int i; rep(i, l - 1) if (is_operator(s[i]) && is_operator(s[i + 1])) return false; return true; } int calc(char *s, int l) { int i, ti = 0, oi = 0, t[5] = {}, o[5] = {}, ans = 0; rep(i, l) { while (!is_operator(s[i]) && i < l) { t[ti] *= 10; t[ti] += s[i] - '0'; i++; } if (i < l) o[oi] = s[i] == '+' ? plus : minus; ti++; oi++; } ans = t[0]; rep(i, oi - 1) { if (o[i] == plus) ans += t[i + 1]; else ans -= t[i + 1]; } return ans; } void rotate(char *s, int l) { char t = s[l - 1]; int i; rrep(i, l - 1) s[i + 1] = s[i]; s[0] = t; return; } int main() { char s[11]; scanf("%s", s); int i, ans = -inf, l = strlen(s); rep(i, l) { if (is_calcable(s, l)) ans = max(ans, calc(s, l)); rotate(s, l); } printf("%d\n", ans); return 0; }