#include #include #include #include #include #include #include #include #include #include #include using namespace std; using int64 = long long; int main() { int n; cin >> n; vector st; for (int i=0; i> c; if (c == "+" || c == "-") { int b = st.back(); st.pop_back(); int a = st.back(); st.pop_back(); int t = (c=="+"? a+b : a-b); st.push_back(t); } else { st.push_back(stoi(c)); } } cout << st.back() << endl; }