#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--) #define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--) #define fi first #define se second #define vi vector #define pb push_back #define mp make_pair #define pcnt __builtin_popcount typedef long long ll; const double inf = 900900900100.0; const int MOD = (int)1e9 + 7; const double EPS = 1e-9; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> s; int res = 0; bool flag = false; rep(i,s.size()) { if(s[i] == '-') flag = true; if(s[i] == '+') flag = false; if(s[i]>='0' && s[i]<='9'){ if(flag) res-=s[i]-'0'; else res += s[i]-'0'; flag = false; } if (s[i] == '('){ int tmp=0; if(s[i+2]=='+'){ tmp = (s[i+1]-'0')+(s[i+3]-'0'); } if(s[i+2]=='-'){ tmp = (s[i+1]-'0')-(s[i+3]-'0'); } if(flag) res-=tmp; else res += tmp; flag = false; i+=4; } } cout << res << endl; return 0; }