#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);
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RhY2s+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCXN0YWNrPGludD5zdDsKCWNoYXIgeDsKCXdoaWxlKGNpbj4+eCl7CgkJaWYoeD49JzAnIGFuZCB4PD0nOScpIAoJCXN0LnB1c2goeC0nMCcpOwoJCWlmKHg9PScrJyl7CgkJCWludCBhPXN0LnRvcCgpOwoJCQlzdC5wb3AoKTsKCQkJaW50IGI9c3QudG9wKCk7CgkJCXN0LnBvcCgpOwoJCQlzdC5wdXNoKGErYik7CgkJfQoJfQoJcmV0dXJuIDA7Cn0=