#include #include #include #include #include #include using namespace std; int main(void){ string s; cin >> s; long long ans = 0; int memo = 0;//0 = (*) 1 = (+) for (int l = 0; l < s.size(); ++l){ double cnt = -1; int now = 0; int r; for (r = l; r < s.size(); ++r){ if(s[r] == '*' || r == s.size() - 1){ if(r != s.size() - 1){ for (int i = l; i < r; ++i){ now += (s[i] - '0') * pow(10, cnt); cnt--; } }else{ for (int i = l; i <= r; ++i){ now += (s[i] - '0') * pow(10, cnt + 1); cnt--; } } if(memo == 0) ans += now; else ans *= now; // printf("1 %d %d %d %lld\n", l, r, now, ans); memo = 0; break; }else if(s[r] == '+' || r == s.size() - 1){ if(r != s.size() - 1){ for (int i = l; i < r; ++i){ now += (s[i] - '0') * pow(10, cnt); cnt--; } }else{ for (int i = l; i <= r; ++i){ now += (s[i] - '0') * pow(10, cnt + 1); cnt--; } } if(memo == 0) ans += now; else ans *= now; // printf("2 %d %d %d %lld\n", l, r, now, ans); memo = 1; break; } cnt++; } // printf("r:%d\n", r); l = r; // printf("lsaigo:%d\n", l); } printf("%lld\n", ans); return 0; }