#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const constexpr int INF = 1e9; typedef pair P; #define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i) #define REP(i, n) FOR(i, 0, n) typedef long long ll; typedef vector VI; const constexpr ll MOD = 1e9 + 7; const int BITSIZE = 100010; struct Less { bool operator()(const pair& x, const pair& y) const { return x.second < y.second; } }; struct More { bool operator()(const pair& x, const pair& y) const { return x.first > y.first; } }; //1-indexed int bit[100010]; int bit_query(int i) { int res = 0; for (; i >= 1; i -= i & -i) res = max(res, bit[i]); return res; } void bit_set(int x, int v) { for (; x <= BITSIZE; x += x & -x) { bit[x] = max(bit[x], v); } } ll N, D; bool dp[10100]; int p[110]; int main() { string s; cin >> s; queue st; s+="b"; int ans = 0; REP(i, s.size()) { if (s[i] == '*' || s[i] == '+' || i == s.size()-1) { int idx = 1; int t = 1, sum = 0; while (1) { if (i - idx < 0||s[i - idx] == '*' || s[i - idx] == '+' ) break; sum += (s[i - idx] - '0')*t; t *= 10; idx++; } st.push(sum); } } REP(i, s.size()) { if (s[i] == '*') { int p, q; p = st.front(); st.pop(); q = st.front(); st.pop(); st.push(p + q); } if (s[i] == '+') { int p, q; p = st.front(); st.pop(); q = st.front(); st.pop(); st.push(p * q); } } cout << st.front() << endl; return 0; }