#include<stdlib.h>
#include<cstdio>
#include<cmath>
#include<stack>
using namespace std;
stack <int> s;int x,y;char a;
int main(){
while(a!='@'){
while(scanf("%c",&a)!='.'){
if(a>='0'&&a<='9'){
int a1=atoi(a);
s.push(a1);
}
if(a=='+') x=s.top();s.pop();y=s.top();s.pop();s.push(y+x);
if(a=='-') x=s.top();s.pop();y=s.top();s.pop();s.push(y-x);
if(a=='*') x=s.top();s.pop();y=s.top();s.pop();s.push(y*x);
if(a=='/') x=s.top();s.pop();y=s.top();s.pop();s.push(y/x);
}
}
printf("%d",s.top());
return 0;
}