#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(int i=(a);i<(b);++i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define MOD 1000000007 long long ston(string s){ long long n; sscanf(s.c_str(), "%lld", &n); return n; } int calc(string s){ vector v; vector vp; string a=""; rep(i,0,s.sz){ if(s[i]=='+'){ v.pb(ston(a)); vp.pb(1); a=""; } else if(s[i]=='-'){ v.pb(ston(a)); vp.pb(0); a=""; } else{ a+=s[i]; } } v.pb(ston(a)); int ret = v[0]; rep(i,0,vp.sz){ if(vp[i]==1){ ret += v[i+1]; } if(vp[i]==0){ ret -= v[i+1]; } } return ret; } int main(){ string s; cin>>s; int mx = 0; rep(i,0,s.sz){ string ss; rep(j,1,s.sz){ ss += s[j]; } ss += s[0]; s=ss; if(s[0]=='+'||s[0]=='-'||s[s.sz-1]=='+'||s[s.sz-1]=='-'){ continue; } mx = max(mx,calc(s)); } cout << mx << endl; return 0; }