int main(){
  char in;
  int Ans[100];
  int i=0,n;
  while(1){
    scanf("%c",&in);
    if(in=='\n')break;
    if(in==' ')continue;
    else if(in!='+'&&in!='-'&&in!='*'){
      Ans[i]=atoi(&in);
      i++;
    }else{
      if(in=='+'){
	Ans[i-2]=Ans[i-2]+Ans[i-1];
	i--;
      }else if(in=='-'){
	Ans[i-2]=Ans[i-2]-Ans[i-1];
	i--;
      }else if(in=='*'){
	Ans[i-2]=Ans[i-2]*Ans[i-1];
	i--;
      }
    }
  }
  n=i;
  for(i=0;i<n;i++){
    printf("%d ",Ans[i]);
  }printf("\n");
  return 0;
}