#include #include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main(){ string s; cin >> s; deque dq1; for (int i = 0; i < s.size(); i++){ string f, b; f = s.substr(0, i); b = s.substr(i); b += f; if (b[0] != '+' && b[0] != '-' && b[b.size()-1] != '+' && b[b.size()-1] != '-') dq1.push_back(b); } int ans = 0; while (!dq1.empty()) { string num = ""; string ss = dq1.front(); char op = '\0'; int tmp = 0; for (int i = 0; i < ss.size(); i++){ if (ss[i] >= '0' && ss[i] <= '9') num += ss[i]; else { if (op == '\0' || op == '+') tmp += stoi(num); else tmp -= stoi(num); num = ""; if (ss[i] == '+') op = '+'; else op = '-'; } if (i == ss.size() - 1){ if (op = '+') tmp += stoi(num); else tmp -= stoi(num); } } ans = max(ans, tmp); dq1.pop_front(); } cout << ans << endl; }