#include using namespace std; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) typedef string::const_iterator st; int num(st &s){ int ret = 0; while(isdigit(*s)){ ret = ret * 10 + (*s - '0'); s++; } return ret; } int expr(st &s){ int ret = num(s); while(1){ if(*s == '+'){ s++; ret += num(s); } else if(*s == '-'){ s++; ret -= num(s); } else break; } return ret; } int calc(string s){ st ss=s.begin(); return expr(ss); } int main(){ string s; cin >> s; int res = 0, n = s.length(); REP(i,n){ if(isdigit(*s.begin()) && isdigit(*(s.end()-1))){ res = max(res, calc(s)); } s.push_back(s.front()); s.erase(s.begin()); } cout << res << endl; }