
#include<bits/stdc++.h>
using namespace std;
string s;
stack<int> a;
int main()
{
	
	while(cin >> s&&s!="@"){
		if(s=="+"){
			int f=a.top();
			a.pop();
			int l=a.top();
			a.pop();
			a.push(f+l);
		}
		else if(s=="-"){
			int f=a.top();
			a.pop();
			int l=a.top();
			a.pop();
			a.push(l-f);
		}
		else if(s=="*"){
			int f=a.top();
			a.pop();
			int l=a.top();
			a.pop();
			a.push(f*l);
		}
		else if(s=="/"){
			int f=a.top();
			a.pop();
			int l=a.top();
			a.pop();
			a.push(l/f);
		}
		else{
			int k=0;
			int p=s.size()-1;
			while(p>=0){
				k=k*10+int(s[p]-'0');
				p--;
			}
			a.push(k);
		}
	}
	cout << a.top() << endl;
	return 0;
}
和P1449很像,只不过操作数末尾和操作符末尾都是空格