#include #include #include using namespace std; int main() { stack st; string s; while (cin >> s) { if (s == "push") { int x; cin >> x; st.push(x); } else if (s == "pop") { st.pop(); } else if (s == "add") { int op2 = st.top(); st.pop(); int op1 = st.top(); st.pop(); st.push(op1 + op2); } else if (s == "mul") { int op2 = st.top(); st.pop(); int op1 = st.top(); st.pop(); st.push(op1 * op2); } else if (s == "print") { cout << st.top() << endl; } } }