#include #include #include #include #include #include #include #include #define REP(i,k,n) for(int i=k;i P; int main() { string s; cin >> s; vector v; stringstream ss; rep(i,s.size()) { if(s[i] == '-') { string t = ss.str(); if(t.size() > 0) v.push_back(t); v.push_back("-"); ss.str(""); ss.clear(stringstream::goodbit); } else if(s[i] == '+') { string t = ss.str(); if(t.size() > 0) v.push_back(t); v.push_back("+"); ss.str(""); ss.clear(stringstream::goodbit); } else { ss << s[i]; } } v.push_back(ss.str()); ss.str(""); ss.clear(stringstream::goodbit); if(v[0] == "-" || v[0] == "+") { vector t; t.push_back(v[0] + v[1]); REP(i,2,v.size()) t.push_back(v[i]); v.clear(); copy(t.begin(),t.end(),back_inserter(v)); } if(v.size() == 3) { int ans = 0; ss << v[0]; ss >> ans; ss.str(""); ss.clear(stringstream::goodbit); if(v[1] == "+") { int t; ss << "-" + v[2]; ss >> t; ans += t; } else { int t; ss << "+" + v[2]; ss >> t; ans += t; } cout << ans << endl; } else { int ans = 0; ss << v[0]; ss >> ans; ss.str(""); ss.clear(stringstream::goodbit); if(v[1] == "+" && v[2] == "+") { int t; ss << "-" + v[3]; ss >> t; ans += t; } else if(v[1] == "+" && v[2] == "-") { int t; ss << "+" + v[3]; ss >> t; ans += t; } else if(v[1] == "-" && v[2] == "+") { int t; ss << "+" + v[3]; ss >> t; ans += t; } else if(v[1] == "-" && v[2] == "-") { int t; ss << "-" + v[3]; ss >> t; ans += t; } cout << ans << endl; } return 0; }