#include #include int main() { char c; char n_[6]; int n[50]; char o[50]; int pn_ = 0, pn = 0, po = 0; while ((c = getchar()) != '\n') { if (c == '*') { o[po++] = c; n_[pn_] = '\0'; n[pn++] = atoi(n_); pn_ = 0; } else if (c == '+') { o[po++] = c; n_[pn_] = '\0'; n[pn++] = atoi(n_); pn_ = 0; } else { n_[pn_++] = c; } } n_[pn_] = '\0'; n[pn++] = atoi(n_); int r = n[0]; int i; for (i = 0; i < pn - 1; i++) { if (o[i] == '*') r += n[i + 1]; else r *= n[i + 1]; } printf("%d\n", r); return 0; }