#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;
}