#include #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() #define ll long long #define ld long double #define INF 1000000000000000000 typedef pair pll; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; vector v; int ans = 0; bool j = 0; rep(i, s.size()) { int tmp = 0; if (s[i] == '(') { int cnt = 0; bool judge = 0; while (1) { i++; if (s[i] == ')') break; if (s[i] == '+') continue; if (s[i] == '-') judge = 1; else if (judge) cnt -= (s[i] - '0'), judge = 0; else cnt += (s[i] - '0'); } tmp = cnt; if (j) ans -= cnt; else ans += cnt; } else if (s[i] == '-') j = 1; else if (s[i] == '+') j = 0; else if (j) { tmp = s[i] - '0'; ans -= tmp; } else { tmp = s[i] - '0'; ans += tmp; } } cout << ans << endl; return 0; }