#include using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); int n;cin>>n; stack st; int x,y; string s; stringstream ss; rep(i,n){ cin>>s; if(s=="+"){ x=st.top();st.pop(); y=st.top();st.pop(); st.push(x+y); }else if(s=="-"){ x=st.top();st.pop(); y=st.top();st.pop(); st.push(y-x); }else{ ss<>x; st.push(x); } } cout<