#include typedef std::string::const_iterator State; int number(State& state){ int res = 1; if(*state == '+'){ ++state; }else if(*state == '-'){ res = -1; ++state; } int _ = 0; for(;std::isdigit(*state);++state){ _ = _ * 10 + *state - '0'; } return res * _; } int expr(State& state){ int a = number(state); if(*state == '+'){ ++state; return a - number(state); }else if(*state == '-'){ ++state; return a + number(state); } } int main(){ std::string S; std::cin >> S; State state = S.begin(); std::cout << expr(state) << std::endl; }