#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); string S; cin >> S; int siz = S.size(); S += S; ll ans = LLONG_MIN; rep(i, 0, siz) { if (S[i] == '+' || S[i] == '-' || S[i + siz - 1] == '+' || S[i + siz - 1] == '-') continue; ll sign = 1; ll num = 0; ll res = 0; rep(j, i, i + siz) { if (S[j] == '+') { res += sign * num; sign = 1; num = 0; } else if (S[j] == '-') { res += sign * num; sign = -1; num = 0; } else { num *= 10; num += S[j] - '0'; } } res += sign * num; ans = max(res, ans); } cout << ans << '\n'; }