#include #include #include using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int main(){ string s; cin>> s; int n=s.size(); int res=0; for(int i=n-1; i>=0; i--){ if(s[i]=='+' or s[i]=='-') continue; int sub=0, sgn; if(s[i]==')'){ while(s[--i]!='('){ if(s[i]=='+' or s[i]=='-') continue; int _sgn=(i-1>=0 and s[i-1]=='-') ? -1 : 1; sub+=(s[i]-'0')*_sgn; } sgn=(i-1>=0 and s[i-1]=='-') ? -1 : 1; }else if('0'<=s[i] and s[i]<='9'){ sub=s[i]-'0'; sgn=(i-1>=0 and s[i-1]=='-') ? -1 : 1; } res+=sub*sgn; } cout<< res<< endl; return 0; }