#include <iostream>
#include <string>
#include <stack>
#include <cctype>
using namespace std;
stack<char> st;
int main()
{
char ch;
while(cin >> ch)
{
if(ch=='@')
{
break;
}
if(isdigit(ch))
{
st.push(ch);
}
else if(ch=='+')
{
int n1=st.top();
st.pop();
int n2=st.top();
st.pop();
st.push(n2+n1);
}
else if(ch=='-')
{
int n1=st.top();
st.pop();
int n2=st.top();
st.pop();
st.push(n2-n1);
}
else if(ch=='*')
{
int n1=st.top();
st.pop();
int n2=st.top();
st.pop();
st.push(n2*n1);
}
else if(ch=='/')
{
int n1=st.top();
st.pop();
int n2=st.top();
st.pop();
st.push(n2/n1);
}
else
{
continue;
}
}
cout << st.top() << endl;
return 0;
}