#include #include #include using namespace std; int main() { string S; cin >> S; int res = 0; string curnum = ""; char curop = '\0'; for (char c : S) { if (c == '*' || c == '+') { switch (curop) { case '*': { res += stoi(curnum); break; } case '+': { res *= stoi(curnum); break; } case '\0': { res = stoi(curnum); break; } default: break; } curnum = ""; curop = c; } else { curnum += c; } } if (curnum != "") { switch (curop) { case '*': { res += stoi(curnum); break; } case '+': { res *= stoi(curnum); break; } case '\0': { res = stoi(curnum); break; } default: break; } } cout << res << endl; }