#include<iostream>
#include<stack>
#include<cstring>
using namespace std;
const int N=1010;
int main()
{
int now;
char a;
stack<int> s;
while((a=getchar())!='@')
{
if(a>='0'&&a<='9')
{
now*=10;
now+=a-'0';
}
else if(a=='.')
{
s.push(now);
now=0;
}
else if(a=='+')
{
int y=s.top();s.pop();
int x=s.top();s.pop();
int z=x+y;
s.push(z);
}
else if(a=='-')
{
int y=s.top();s.pop();
int x=s.top();s.pop();
int z=x-y;
s.push(z);
}
else if(a=='*')
{
int y=s.top();s.pop();
int x=s.top();s.pop();
int z=x*y;
s.push(z);
}
else if(a=='/')
{
int y=s.top();s.pop();
int x=s.top();s.pop();
int z=x/y;
s.push(z);
}
}
cout<<s.top()<<endl;
return 0;
}