#include<bits/stdc++.h>
using namespace std;
stack <int> s1;
int main(){
char a;
int b,x,y;
while(a!='@'){
b=((int)a)-48;
if(a>='0'&&a<='9'){
s1.push(b);
}
else if(a=='+'){
x=s1.top();
s1.pop();
y=s1.top();
s1.pop();
s1.push(x+y);
}
else if(a=='-'){
x=s1.top();
s1.pop();
y=s1.top();
s1.pop();
s1.push(x-y);
}
else if(a=='*'){
x=s1.top();
s1.pop();
y=s1.top();
s1.pop();
s1.push(x*y);
}
else if(a=='/'){
x=s1.top();
s1.pop();
y=s1.top();
s1.pop();
s1.push(x/y);
}
}
cout<<s1.top();
return 0;
}