#include<bits/stdc++.h>
#define ll long long
using namespace std;
int k;
char a[110];
stack<int>s;
int main(){
scanf("%s",a);
int l=strlen(a),i=0;
while(l--){
if(a[i]>='0'&&a[i]<='9'){
k*=10;
k+=a[i]-'0';
}
if(a[i]=='+'){
int t1=s.top();
s.pop();
int t2=s.top();
s.pop();
s.push(t1+t2);
}
if(a[i]=='-'){
int t1=s.top();
s.pop();
int t2=s.top();
s.pop();
s.push(t1-t2);
}
if(a[i]=='*'){
int t1=s.top();
s.pop();
int t2=s.top();
s.pop();
s.push(t1*t2);
}
if(a[i]=='/'){
int t1=s.top();
s.pop();
int t2=s.top();
s.pop();
s.push(t1/t2);
}
if(a[i]=='.'){
s.push(k);
k=0;
}
i++;
}
int t=s.top();
printf("%d",t);
return 0;
}