#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<stack>
using namespace std;
string s;
stack<int>z;
int a[55],n;
int main(){
cin>>s;
int len=s.size();
string ss;
for(int i=0;i<len;i++){
if(a[i]=='@') break;
if(a[i]>='0'&&a[i]<='9'){
n=n*10+a[i]-'0';
}
else if(a[i]=='.'){
z.push(n);
n=0;
}
else{
int x,y,t;
x=z.top();
z.pop();
y=z.top();
z.pop();
if(a[i]=='+') t=x+y;
else if(a[i]=='-') t=y-x;
else if(a[i]=='*') t=x*y;
else if(a[i]=='/') t=y/x;
z.push(t);
}
}
printf("%d",z.top());
return 0;
}