#include <iostream>
#include<string>
#include<stack>
#include<cctype>
using namespace std;
int main()
{
string s;
cin>>s;
stack<int> st;int a(0);
for(int i=0;i<s.length();i++)
{
if(s[i]=='@') break;
if(isdigit(s[i]))
{
a*=10;
a+=(s[i]-'0');
}
if(s[i]=='.')
{
st.push(a);
a=0;
}
int c,j;
if(s[i]=='+'){c=st.top();st.pop(); j=st.top();st.push(c+j);}
if(s[i]=='-') {c=st.top();st.pop(); j=st.top();st.push(j-c);}
if(s[i]=='*') {c=st.top();st.pop(); j=st.top();st.push(c*j);}
if(s[i]=='/') {c=st.top();st.pop(); j=st.top();st.push(j/c);}
}
cout<<st.top()<<endl;
return 0;
}