#include<bits/stdc++.h>
using namespace std;
stack <int> c;
string s;
int main() {
cin>>s;
for(int i=0;i<s.length();i++){
int n=0;
if(s[i]=='@') break;
else if(s[i]>='0'&&s[i]<='9'){
if(n!=0){
n=n*10+s[i]-48;
}
else n=s[i]-48;
}
else if(s[i]=='.'){
c.push(n);
n=0;
}
else{
int x=c.top();
c.pop();
int y=c.top();
c.pop();
if(s[i]=='+') c.push(x+y);
if(s[i]=='-') c.push(y-x);
if(s[i]=='*') c.push(x*y);
if(s[i]=='/') c.push(y/x);
}
}
cout<<c.top();
return 0;
}