#include using namespace std; const int INF = 1e9; int f(string S) { int sign = 1, ret = 0, now = 0; bool flag = false; S += '+'; for (auto& c : S) { if (c == '+' || c == '-') { if (!flag) return -INF; ret += now * sign; now = 0; sign = ((c == '+') ? 1 : -1); flag = false; } else { now *= 10; now += (c - '0'); flag = true; } } return ret; } int main() { string S; cin >> S; int N = S.length(); S += S; int ans = -INF; for (int i = 0; i < N; i++) { ans = max(ans, f(S.substr(i, N))); } cout << ans << endl; }