#include #include using namespace std; int main(){ string s,tmp = ""; char prev; cin >> s; int ans = 0; for(char c: s){ if(c == '*'){ if(prev == '*') ans += (int)stoi(tmp); if(prev == '+') ans *= (int)stoi(tmp); if(!(prev == '*' || prev == '+')) ans += (int)stoi(tmp); prev = '*'; tmp = ""; }else if(c == '+'){ if(prev == '+') ans *= (int)stoi(tmp); if(prev == '*') ans += (int)stoi(tmp); if(!(prev == '*' || prev == '+')) ans += (int)stoi(tmp); prev = '+'; tmp = ""; }else tmp += c; //debug // cout << "tmp: " << tmp << endl; // cout << "ans: " << ans << endl; // cout << "prev: " << prev << endl; // cout << endl; } if(prev == '*') ans += (int)stoi(tmp); if(prev == '+') ans *= (int)stoi(tmp); cout << ans << endl; return 0; }