#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) #define RREP(i, n) for(int i=(n)-1;i>=0;i--) #define FOR(i, b, e) for(int i = b; i < e; i++) #define to_bit(i) static_cast< bitset<8> >(i) #define INF (1<<28) #define EPS 1e-9 int main(int argc, const char * argv[]){ // cout << (int)'+' << endl; // cout << (int)'-' << endl; // cout << (int)'0' << endl; string str; cin >> str; FOR(i, 1, str.length()){ if(str[i-1] >= '0'){ if(str[i] == '-'){ str[i] = '+'; }else if(str[i] == '+'){ str[i] = '-'; } } } // cout << str << endl; int ans = 0; int num = 0; int op = 1; REP(i,str.length()){ switch (str[i]) { case '+': ans += op * num; if(num != 0) op = 1; num = 0; break; case '-': ans += op * num; if(num != 0) op = 1; num = 0; op *= -1; break; default: num *= 10; num += (int)(str[i] - '0'); break; } } ans += op * num; cout << ans << endl; }