#include <stdio.h>
int a[500],head=0;
int main(){
????int b,num=0;
????char c;
??????
????while( (scanf("%c",&c))!=EOF){ 
????????if(num==0&&c=='0'){ a[head]=num;
????????????head++;}
??
????????????if(a<='9'&&c>='0'){num=c-'0'+num*10;}?????????? 
????????????else if(num!=0){?? 
????????a[head]=num;
????????head++;
????????num=0;
????????????}
????????????else {num=0;
????????if(c=='+'){
????????????a[head-2]+=a[head-1];
????????????head--;
????????}
????????else if(c=='*'){
????????????a[head-2]*=a[head-1];
????????????head--;
????????}
??
????????else if(c=='-'){
????????????a[head-2]-=a[head-1];
????????????head--;
????????}
????????????}?? 
????}
??????????
printf("%d\n",a[head-1]);?? 
??
????return 0;
}