#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int>st;
char x;
while(cin>>x){
if(x>='0' and x<='9')
st.push(x-'0');
if(x=='+'){
int a=st.top();
st.pop();
int b=st.top();
st.pop();
st.push(a+b);
}
else if(x=='-'){
int a=st.top();
st.pop();
int b=st.top();
st.pop();
st.push(b-a);
}
else if(x=='*'){
int a=st.top();
st.pop();
int b=st.top();
st.pop();
st.push(a*b);
}
} cout<<st.top();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RhY2s+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCXN0YWNrPGludD5zdDsKCWNoYXIgeDsKCXdoaWxlKGNpbj4+eCl7CgkJaWYoeD49JzAnIGFuZCB4PD0nOScpIAoJCXN0LnB1c2goeC0nMCcpOwoJCWlmKHg9PScrJyl7CgkJCWludCBhPXN0LnRvcCgpOwoJCQlzdC5wb3AoKTsKCQkJaW50IGI9c3QudG9wKCk7CgkJCXN0LnBvcCgpOwoJCQlzdC5wdXNoKGErYik7CgkJfQoJCWVsc2UgaWYoeD09Jy0nKXsKCQkJaW50IGE9c3QudG9wKCk7CgkJCXN0LnBvcCgpOwoJCQlpbnQgYj1zdC50b3AoKTsKCQkJc3QucG9wKCk7CgkJCXN0LnB1c2goYi1hKTsKCQl9CgkJZWxzZSBpZih4PT0nKicpewoJCQlpbnQgYT1zdC50b3AoKTsKCQkJc3QucG9wKCk7CgkJCWludCBiPXN0LnRvcCgpOwoJCQlzdC5wb3AoKTsKCQkJc3QucHVzaChhKmIpOwoJCX0gCgl9IGNvdXQ8PHN0LnRvcCgpOwoJcmV0dXJuIDA7Cn0=