#include using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(int)(n);i++) #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define all(x) (x).begin(),(x).end() #define pb push_back #define mp make_pair #define mt make_tuple typedef pair pii; typedef vector vi; typedef vector vvi; const int inf = 1LL<<60; const int mod = 1e9 + 7; const double eps = 1e-9; /*{ }*/ signed main() { string s; cin >> s; int n = s.size(); s += s; int ans = 0; rep(i, n){ if(s[i] == '+' or s[i] == '-' or s[n-1+i] == '+' or s[n-1+i] == '-') continue; int tmp = 0, t = 0, op = 0; rep(j, n){ if('0' <= s[i+j] and s[i+j] < '9'){ t = 10*t + s[i+j]-'0'; }else{ if(op == 0){ tmp += t; }else{ tmp -= t; } t = 0; op = s[i+j] == '-'; } } if(op == 0){ tmp += t; }else{ tmp -= t; } ans = max(ans, tmp); } cout << ans << endl; return 0; }