#include<stdio.h>
#define NUM  100


int main(){
  int i=0;
  char c;
  char a[NUM];

  for(i=0;i<NUM;i++){
    a[i]=0;
  }
  i=0;

  while((c=getchar())!='\n'){
    if(c>='0' && c<='9'){
      a[i]=10*a[i]+(c-'0');
    }
    if(c==' '){
      i++;
    }
    if(c=='+'){
      i--;
      a[i-1]+=a[i];
      a[i]=0;
      i--;
    }

    if(c=='-'){
      i--;
      a[i-1]-=a[i];
      a[i]=0;
      i--;
    }

    if(c=='*'){
      i--;
      a[i-1]*=a[i];
      a[i]=0;
      i--;
    }
  }

  printf("%d\n",a[0]);
  
  return 0;
}

