#include using namespace std; int main(){ string s; cin >> s; stack op, optmp; bool braket = false; int ans = -1e5; int tmp = -1e5; for (int i = 0; i < (int) s.size(); i++) { if (s[i] == '+') { if (!braket) op.push(1); else optmp.push(1); } else if (s[i] == '-') { if (!braket) op.push(-1); else optmp.push(-1); } else if (s[i] == '(') { braket = true; } else if (s[i] == ')') { braket = false; if (ans == -1e5) { ans = tmp; } else { ans += op.top() * tmp; op.pop(); } tmp = -1e5; } else { int n = s[i] - '0'; if (braket) { if (tmp == -1e5) { tmp = n; if (!optmp.empty()) { tmp *= optmp.top(); optmp.pop(); } } else { tmp += optmp.top() * n; optmp.pop(); } } else { if (ans == -1e5) { ans = n; if (!op.empty()) { ans *= op.top(); op.pop(); } } else { ans += op.top() * n; op.pop(); } } } } cout << ans << endl; return 0; }