#include #include using namespace std; int main() { string S; cin >> S; int ans = 0, mul = 1; int temp = 0; char pre_symbol = '\0', symbol = '\0'; for (int i = 0; i < S.length();i++) { if (S[i] == '*' || S[i] == '+') { if (symbol == '\0') { symbol = S[i]; ans = temp; temp = 0; } else { pre_symbol = symbol; symbol = S[i]; if (pre_symbol == '*') { ans += temp; } else { ans *= temp; } temp = 0; } continue; } temp = 10*temp + (S[i] - '0'); } if (symbol == '*') { ans += temp; } else { ans *= temp; } cout << ans << endl; return 0; }