#include <stdio.h>
#include <math.h>

int main(){
  char s[100];
  int n=0,i,Stac[100];
  while(scanf("%s",s) != EOF){
    if(*s==' ') continue;
    if(*s == '+')Stac[n-1]+=Stac[n-2];
    else if(*s == '-')Stac[n-1]-=Stac[n-2];
    else if(*s == '*')Stac[n] = Stac[n-2]*Stac[n-5];
    
    else Stac[n] = atoi(s);
    n++;
  }
  for(i=0;i<n+1;i++){
    printf("%d\n",Stac[i]);
  }
    
  printf("%d\n",Stac[n]);

  return 0;
}

