#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); auto f = [](string s) { int n = int(s.size()); int sgn = +1, res = 0; for(int i = 0; i < n; i++) { if(isdigit(s[i])) { int pos = i, num = 0; while(pos < n && isdigit(s[pos])) { num = num * 10 + (s[pos] - '0'); pos++; } res += sgn * num; } else { if(s[i] == '+') sgn = +1; if(s[i] == '-') sgn = -1; } } return res; }; string s; cin >> s; string t = ""; int n = int(s.size()); for(int i = 0; i < n; i++) { if(s[i] == '(') { int j = i + 1; for(; j < n; j++) if(s[j] == ')') break; string u = ""; for(int k = i + 1; k < j; k++) u += s[k]; t += to_string(f(u)); i = j; } else { t += s[i]; } } cout << f(t) << "\n"; }